Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Makin it cartoonish.

Discussion in 'Getting Started' started by Funwill, Oct 28, 2022.

  1. Funwill

    Funwill

    Joined:
    Nov 10, 2018
    Posts:
    125
    Greets!

    I'd like to give my 3D open world a cartoonish look. There are some online sites offerin possibilities to convert images to comics, but could i apply this with unity and its textures/meshes?

    Cheers!
     
  2. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    550
    You can achieve similar functionality as those sites by creating custom screen space post processing effect
    https://www.benmandrew.com/articles/custom-post-processing-effects-in-unity
    The effect you need is analog of Posterize filter in Photoshop. I do not understand the exact math behind it, but I think it should go like the following:
    Code (CSharp):
    1. float PosterizeStep = 0.25//some value in 0 to 1 range. 0.25 will mean 4 levels of posterisation
    2. fixed4 col = tex2D(_MainTex, i.uv);//screen rendered to texture
    3. col.r = floor(col.r/PosteriseStep) * PosteriseStep//divide each channel value by Step, then round to the lowest integer. Multiply again by Step to keep the result in 0-1 range
    4. col.g = floor(col.r/PosteriseStep) * PosteriseStep
    5. col.r = floor(col.r/PosteriseStep) * PosteriseStep
    6. return col;
    A visual representation (Blender shader editor):
    https://gyazo.com/8816df083dd653d8daca8975179f4630
    Keep in mind that it will be very low quality effect and more complicated in practice (at the very least, you'll need an ability to exclude some scene elements from posterization, like UI). Commercial games usually utilize individual assets with cartoon stylization
     
  3. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    550
  4. Funwill

    Funwill

    Joined:
    Nov 10, 2018
    Posts:
    125
    Last edited: Nov 1, 2022
  5. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    550
    The link is Ok on my end.
    But it was a same code illustrated through nodes (visual programming)
    And if you do not plan to code post processing effect yourself, check Asset Store for "cartoon post processing". Though I do not think there are filters based on neural networks, more likely it will also be posterize or gradient mapping. If the services you mention use remote servers, the algorithms might be too slow for use in a real time game
     
  6. Funwill

    Funwill

    Joined:
    Nov 10, 2018
    Posts:
    125
    Coool, there's one realy promisin, HDRP cartoon post processin. But HDRP, seems to be an improved renderin, right? Bein on linux, could i upgrade to it?
     
  7. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    550
    I didnt work with HDRP. In theory, the Linux platform shouldnt be an issue, but there may be lot of other pitfalls. Backup your project before switching to HDRP, and additionally ask about consequences on HDRP forum: https://forum.unity.com/forums/high-definition-render-pipeline.386/
     
  8. Funwill

    Funwill

    Joined:
    Nov 10, 2018
    Posts:
    125
    Goody good. Many thxs for your advices and suggestion!
     
  9. BrandyStarbrite

    BrandyStarbrite

    Joined:
    Aug 4, 2013
    Posts:
    2,065
    The other way to make your textures cartoonish, is if you have some art skills, put your textures into a software similar to photoshop, and use effects, and filters on each of the image textures, and probably paint over them, using blend effects and transparency. It's actually kind of fun too.
     
    Last edited: Nov 3, 2022
  10. Funwill

    Funwill

    Joined:
    Nov 10, 2018
    Posts:
    125
    Could be tedious as well, with so many textures, though if done at the pace of each textures, why not... Would you think Gimp would enable the same effects?
     
  11. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    550
    Yes. Painting tools and filters should be similar enough
     
    BrandyStarbrite likes this.
  12. BrandyStarbrite

    BrandyStarbrite

    Joined:
    Aug 4, 2013
    Posts:
    2,065
    Yep, it might be a bit tedious.
    And as stated in DimitriX89 comment, some of the effects should be similar. Last time I used it, gimp had a filter effect, that automatically made pics or textures, look cell shaded and cartoony. It didn't look bad at all, but you might probably want to do some small tests, to get your desired cel shaded look for your textures.
     
    Last edited: Nov 3, 2022
  13. Funwill

    Funwill

    Joined:
    Nov 10, 2018
    Posts:
    125
    Sure, i'll test that. Thxs you all!