Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Problem with lava shader

Discussion in 'General Graphics' started by Jayjayfast, Nov 29, 2023.

  1. Jayjayfast

    Jayjayfast

    Joined:
    Sep 12, 2023
    Posts:
    28
    Hi,

    I'm experimenting with creating my own 3d models and shaders and I'm having issues with my lava effect shader.
    image_2023-11-29_155131626.png
    It's a very basic lava effect and it looks great in the sample window, but when I apply it to my Mushroom, (yes it is a lava mushroom), the Lava effect works on the stem but not the head of the mushroom. On the head it is stretched into long vertical lines.
    Screenshot 2023-11-29 154637.png
    Because I am applying a shoddily made shader, to an equally shoddily made 3d asset, I'm not sure if the issue is with my shader of my model.

    Where am I going wrong exactly?
     

    Attached Files:

  2. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,581
    How are you mapping the texture? The common way is to use UV coordinates. If that's what you are using then you need to make sure that your model has good UV coordinates.
     
    BrandyStarbrite and warthos3399 like this.
  3. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,694
    Time to unwrap UV's...
     
    BrandyStarbrite likes this.
  4. POOKSHANK

    POOKSHANK

    Joined:
    Feb 8, 2022
    Posts:
    145
    use triplanar mapping instead of object's uv's if you really want it to be perfectly tiled on everything without doing the easy work of unwrapping
     
  5. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,846
    To help put things into perspective:

    In all software, models have some data in each of their vertices that is used by the engines to map a 2D image (in this case, your lava) onto their surface.

    This data is called UV coordinates -or texture coordinates- because it's two coordinates per vertex: U and V. So vertices have XYZ coordinates that describe their position in 3D space, and UV coordinates that describe their position in 2D space.

    Now, typically you would "UV unwrap" your model in some external 3D software (Blender, Maya, 3DSMax, Modo, etc) to give it proper uv coordinates and then export the model into Unity. However you can also generate UV coordinates in your shader using a variety of mapping techniques, that take the 3D position of each vertex and generate 2D UV coordinates on the fly. One of these is called "triplanar mapping" which is what POOKSHANK above suggested.

    Whether you should take the mushroom back into an external 3D modeling software and UV unwrap it or modify your shader to use triplanar mapping is up to your specific needs. I would suggest to research both techniques and really understand the concept of texture mapping before deciding.

    cheers!
     
    Jayjayfast likes this.
  6. Jayjayfast

    Jayjayfast

    Joined:
    Sep 12, 2023
    Posts:
    28
    Thankyou

    I am in no way an artist, 3d or otherwise, but I'm finding the process of making my own assets quite satisfying.

    Your help with my daft questions is appreciated.