Unity Community


Page 27 of 146 FirstFirst ... 1725262728293777127 ... LastLast
Results 521 to 540 of 2920
  1. Code Maker

    Location
    Canberra
    Posts
    849
    Quote Originally Posted by dreamora View Post
    the grab pass can technically be rendered whenever you want but doing so prior to the transparent queue doesn't make any sense as it will lack foliage etc on terrain then among many other things.

    Also, that shadows don't work on such surfaces is rather common, you won't find many engines that offer shadow drop onto water for example, especially none that don't cost your soul or corresponding amounts in $$$

    As for the refraction mask: could be a bit tricky but technically you could potentially use a second camera to render such a mask texture through rendertexture to then use in your real shader for example.
    The problem with this is that when you do it you are doing 'hand coded' sorting. This is okay if you can guarente that something will ALWAYS be drawn behind something else. But for many / most situations this is not the case. Some examples of where it might be applicable are water, when things in the water will always be drawn BEFORE the water surface (provided you are not in the water volume looking up). It's a painful situation and unity does not seem to sort non transparent queues.
    Last edited by Tim C; 11-16-2010 at 02:38 PM.
    Have you tried the Strumpy Shader Editor?


  2. Location
    Zürich, Switzerland
    Posts
    26,572
    Such situations are where usage of scripting to dynamically adjust the queue trigger in to keep it alive.
    Its not that common to have combined grab passes as most people prefer to have realtime FPS

  3. Code Maker

    Location
    Canberra
    Posts
    849
    Quote Originally Posted by dreamora View Post
    Such situations are where usage of scripting to dynamically adjust the queue trigger in to keep it alive.
    Its not that common to have combined grab passes as most people prefer to have realtime FPS
    I can just imagine how slow that would be to execute... so many ray casts and bounds checks... or a quadtree or volume structure. Blegh.
    Have you tried the Strumpy Shader Editor?


  4. Location
    Zürich, Switzerland
    Posts
    26,572
    agreed.
    Though such complicated environments don't exist. At least not if you had the target of gaming or realtime as that will never work without raytracers, having multiple dependent refractive transparent surfaces and alike.

    as long as it remains in realistic borders there is an alternative way that potentially works: use distinct cameras that you restrict near - far wise to the distance of the refractive transparent surface and let them render to render texture and then create shaders that build upon these data + what they see on their camera. This could potentially work


  5. Location
    Duluth, MN
    Posts
    109
    Stramit, I asked this question some pages ago. It's fairly simple, and if you have time to answer, this shader noob would greatly appreciate it.

    I've been trying to setup my own skybox shader that blends between 2 cube maps. The shader works fine on a mesh but does not work as a skybox material. Any hints?



    I know this could easily be done in Shaderlab but I'm just trying to learn your awesome tool. =)

  6. Code Maker

    Location
    Canberra
    Posts
    849
    I'll have a look tonight for you Loken. So you are talking about when you actually hook it up into skybox (i.e the camera skybox or the scene skybox. Not just a box you have in the scene?)
    Have you tried the Strumpy Shader Editor?


  7. Location
    Duluth, MN
    Posts
    109
    Yeah, I'm using the Camera Skybox rendering component.

    Thanks for the quick reply!

  8. Code Maker

    Location
    Canberra
    Posts
    849
    Quote Originally Posted by loken View Post
    Yeah, I'm using the Camera Skybox rendering component.

    Thanks for the quick reply!
    Hi loken. Skyboxes are a special case and they do some interesting stuff in the back end. Because of the way they are done they are not supported in the current release, but I have made changes in the code base which will fix them up for 3.1. Thanks for pointing this out to me.

    In 3.1 this is how you would do a skybox shader. Note you still use the UV not the normal. This is because unity passes the correct vertex skybox normals via the UV channels.

    Have you tried the Strumpy Shader Editor?

  9. Code Maker

    Location
    Canberra
    Posts
    849
    If I have missed any questions that have been asked over the past few days I am sorry. Post them again now and I will see what I can do.
    Have you tried the Strumpy Shader Editor?


  10. Location
    Duluth, MN
    Posts
    109
    I had a feeling they were a special case.

    Thanks again, really appreciate it!


  11. Location
    Melbourne, Australia
    Posts
    696
    Stramit I sent you a PM with 2 nodes.

  12. rea rea is offline

    Posts
    705
    Quote Originally Posted by dreamora View Post
    agreed.
    Though such complicated environments don't exist. At least not if you had the target of gaming or realtime as that will never work without raytracers, having multiple dependent refractive transparent surfaces and alike.

    as long as it remains in realistic borders there is an alternative way that potentially works: use distinct cameras that you restrict near - far wise to the distance of the refractive transparent surface and let them render to render texture and then create shaders that build upon these data + what they see on their camera. This could potentially work
    hmm...i guess you guys right about this.. even in the newest COD series they still had false refraction for they're water shader.

  13. rea rea is offline

    Posts
    705
    Name:  Clip_8.jpg
Views: 1283
Size:  228.2 KB
    Well with grab pass limitation, this is as far as i get then...

  14. Code Maker

    Location
    Canberra
    Posts
    849
    If you look at games like bioshock rea they manage to do this type of refraction. The trick seems to be to use a very small distortion offset in the shader so that it minimizes the foreground objects leaking into the distortion (Have a look at the windows in that game looking out into the water) and it might give you some ideas.
    Have you tried the Strumpy Shader Editor?

  15. rea rea is offline

    Posts
    705
    Quote Originally Posted by stramit View Post
    If you look at games like bioshock rea they manage to do this type of refraction. The trick seems to be to use a very small distortion offset in the shader so that it minimizes the foreground objects leaking into the distortion (Have a look at the windows in that game looking out into the water) and it might give you some ideas.
    hmm....i think you're right....somehow i remember reading their water tech somewhere.....
    well i'll see what i can do...


  16. Location
    Melbourne, Australia
    Posts
    696
    The limitation is gotten around by various things. I'll copy this verbatim from a Crytek prentation called "Crysis Next Gen Effects" by Tiago Sousa:

    - Use current back-buffer
    - Mask out everything above water surface
    - Water Depth > World Depth = leaking - disallow refraction texture offset for this case

    http://crytek.com/cryengine/presenta...xt-gen-effects

  17. Code Maker

    Location
    Canberra
    Posts
    849
    Quote Originally Posted by duke View Post
    The limitation is gotten around by various things. I'll copy this verbatim from a Crytek prentation called "Crysis Next Gen Effects" by Tiago Sousa:

    - Use current back-buffer
    - Mask out everything above water surface
    - Water Depth > World Depth = leaking - disallow refraction texture offset for this case

    http://crytek.com/cryengine/presenta...xt-gen-effects
    You might be able to do that in unity actually. Batch the distortion pass into transparent (even if you have zwrite on / no transparency). Grab the current pixel z depth and compare to the one from the depth buffer.

    Anyways here is an example of a distortion effect. What you need to do is have offsets centered around 0. So an offset ranges from -1 -> 1. If you want to get fancy normalize to grab texture dimensions ect, but I am not doing that here. The normalization means that the foreground objects will not leak very much, just a small frill around the edges.

    Note the inclusion of the unpack normal to convert into [-1, 1], this means you need an offset texture encoded this way (for my testing I just used a normal map I had handy)


    Here is an extreme example (I would never use this much in a real game). Notice the foreground cube is preserved, but there is some leakage into whatever is in the background.


    Here is a more realistic example (looks good in motion as well), some small frills.
    Have you tried the Strumpy Shader Editor?

  18. Code Maker

    Location
    Canberra
    Posts
    849
    Quote Originally Posted by duke View Post
    Stramit I sent you a PM with 2 nodes.
    Ah cool. I'll I'll check them out and if they work well I'll put them in 3.1 if that's okay with you.
    Have you tried the Strumpy Shader Editor?


  19. Location
    Melbourne, Australia
    Posts
    696
    Quote Originally Posted by stramit View Post
    Ah cool. I'll I'll check them out and if they work well I'll put them in 3.1 if that's okay with you.
    Yep that was the idea!

  20. rea rea is offline

    Posts
    705
    hey Stramit i sent you a PM, can you check it?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •