Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

NOOB Question

Discussion in 'Shaders' started by bookoute, Apr 2, 2008.

  1. bookoute

    bookoute

    Joined:
    Feb 8, 2008
    Posts:
    5
    WARNING! First post from a noob.

    I am desperately trying to get a "realistic" car paint shader. So far it looks good but i am looking for a way to control the reflections (ie create a falloff that makes the upper half of the car less reflective).

    Thanks
     

    Attached Files:

  2. VICTOM

    VICTOM

    Joined:
    Aug 28, 2005
    Posts:
    233
    I believe you'd want a shader with a specular map - or a texture that tells the shader where and how much specular highlighting in this area of the object.

    Specular maps are used with organic shaders too - for skin - the human face is very specular yet it is no where nearly as uniformly specular as metal.

    Hope this is of some help - check the wiki for other shaders.


    Cheers,
     
  3. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    With the reflective/diffuse shader, the alpha channel in the base image controls the reflection strength. You could make a custom shader that combines the glossy + diffuse shaders, and have the alpha channel either do both gloss and reflection strength, or use a separate alpha map for one or the other.

    --Eric
     
  4. bookoute

    bookoute

    Joined:
    Feb 8, 2008
    Posts:
    5
    That sounds like what I need to do... What would be a good resource to figure our how to do this? Could you point me in the right direction.

    Thanks
     
  5. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I'd say download the shader source (see the stickied forum topic in this category), and read the section about Shaders in the docs.

    --Eric
     
  6. bookoute

    bookoute

    Joined:
    Feb 8, 2008
    Posts:
    5
    Thank You guys for your help. I dont know if this is the right place but can you tell me if there is a good Depth of Field script here somewhere?

    also I have got a great lookiking car. I appreciate the direction. Starting with the skin shader worked perfectly.
     

    Attached Files:

  7. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Check this out.

    --Eric
     
  8. drJones

    drJones

    Joined:
    Oct 19, 2005
    Posts:
    1,351
    that looks really good - it that the standard skin shader with just the bump pass removed?

    i was going for the same effect but since i can't code shaders i went for the more low tech approach by baking it into the reflection with RenderToCubeMap. you can see an example here:

    http://forum.unity3d.com/viewtopic.php?t=10040

    its exaggerated there for a more showroom look - i haven't had time yet to blend it with a standard cubemap to see how well it works in a natural setting (also it seems i can't edit the images of a unity created cubemap so i'll have to change how i make them).
     

    Attached Files:

  9. bookoute

    bookoute

    Joined:
    Feb 8, 2008
    Posts:
    5
    Thats actually the standard skin specular layered on top of a reflective diffuse. I did use the render to cubemap to get the environmental reflection.

    I am wondering the same thing. If anybody knows how to extract the images created with the renderToCubemap process please chime in.

    thanks
     
  10. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    The only way I can think of that may work is to use Cubemap.GetPixel (face : CubemapFace, x : int, y : int), then Texture2D.SetPixel to create a copy and save this texture in a similar way as the Terrain lightmapExport script. But, as I am looking into this right now, I also wonder if this can be done in a easier way?