Search Unity

Geenz's RNM shaders: Now released!

Discussion in 'Made With Unity' started by Geenz, Dec 22, 2010.

  1. Geenz

    Geenz

    Joined:
    Sep 1, 2010
    Posts:
    99
    EXR isn't necessary for normal maps. The only things that really benefit from being encoded as EXRs are lightmaps.
     
  2. Deleted User

    Deleted User

    Guest

    Hi, i bought the shaders now. but it seems i am to unaware to use them.
    actually i don't know how to create compressed RNMs in unity.
    sorry, but RNM stuff is for me completly terra incognita.

    somehow i understand the system. but somehow i don't. :/
     
  3. Deleted User

    Deleted User

    Guest

    i also have some simple stupid questions:

    - do i need dynamic lights (spot/point and so) to bake light informations?
    - can i delete those lights after baking?
    - does beast support lightmaps?
    - is the ramp shader the one i need if i want to create the character shader effect like those of infity blade?
    or is the GzRNM package the right one?

    i think i need a step by step tutorial for dummies. :/
     
  4. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    @Geenz
    any word on a possible fix for the SSBump converter issue I mentioned? Thank you for your hard work, have a nice new year :)
     
  5. Geenz

    Geenz

    Joined:
    Sep 1, 2010
    Posts:
    99
    You need a 3D app such as Maya or Blender to bake illumination to use with the shader.
    At this time, Beast does not support generating RNMs.
    GzRNM does not cover character lighting. Only static environment lighting.
    See the documentation link in the first post.

    @zhx: I'm trying to find a fix for the problem for 1.2. Alternatively, you can use SSBump Generator to generate SSBumpmaps. You just have to swap the green and blue channels in an image editor before you can use it with the shaders.
     
  6. Deleted User

    Deleted User

    Guest

    What do i need then to get character lighting in that way like in infity blade?
     
  7. francksitbon

    francksitbon

    Joined:
    Jan 22, 2010
    Posts:
    268
    Does someone have a nice framerate on iPad with this shader, I'm desperated...
     
  8. Geenz

    Geenz

    Joined:
    Sep 1, 2010
    Posts:
    99
    UDK uses a special lighting system that attempts to simulate incoming lighting based off of a collection of points in the scene. Each point basically encodes a few light directions, and their colors. It's similar to spherical harmonics. To my knowledge, no one's recreated a similar system for Unity (yet).
     
    Last edited: Jan 1, 2011
  9. moska

    moska

    Joined:
    Nov 1, 2009
    Posts:
    27
    ok,i downloaded your RNMExample.unitypackage to have a look.
    please tell me:as i havent buy the shaders yet,they are not in the package imported so how can i experience them?
     
  10. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @moska, if the shaders were included with the demo no one would buy them. Check out the demo Wes made to see them in action on his website. The link is in this thread somewhere.
     
  11. moska

    moska

    Joined:
    Nov 1, 2009
    Posts:
    27
    thankx
    but cant find the link
     
  12. wesrm

    wesrm

    Joined:
    May 20, 2009
    Posts:
    193
    Hi moska,

    I created a quick webplayer demo build. You can find it here on my blog. Let me know if you have any questions about the content : )

    -Wes
     
  13. Geenz

    Geenz

    Joined:
    Sep 1, 2010
    Posts:
    99
  14. wesrm

    wesrm

    Joined:
    May 20, 2009
    Posts:
    193
    Hi,

    I did another test on the demo scene running on the iPad and I wanted to share the results. When building the demo scene to the iPad without dynamic lights, I was getting 33.5ms, which equates to 29.85 FPS. Please see the Internal Profiler output.



    The shader that should be used on iOS and Android devices is the CRNM SSBump Diffuse. It's in the Mobile category for GzRNM version 1.1. As Geenz mentioned earlier in the thread, you definitely want to avoid dynamic lighting if all possible with iOS. It doesn't mean you can't use dynamic lights, but due to the resource limitations, you could experience drops in framerate. If you would like to use dynamic lights, use them sparingly and it may call for further optimizations in your scene such as reducing vertex count. Optimization is such a give and take. If you pull resources from one end, you'll always need to compensate by giving from another.

    With that said, it's also important that you use the right shaders. For instance, on the webplayer version of the GzRNM demo, I used the Self-Illum vertex lit shader for the light bulb in the demo scene. When I first built the scene to my iPad, I forgot to change the shader and I notice I was getting a frametime of 60ms or 16 FPS. When I changed this shader to the Mobile/Vertex Lit shader in the Standard Package Mobile, the performance jumped dramatically back to 30 FPS.

    If you are experiencing low FPS performance using GzRNM on the iPad, make sure you're using the correct GzRNM mobile shader. Also, make sure that any other shaders in your scene are equally optimized for mobile use, such as the Mobile shaders that come with the Unity Standard Package.

    From my experience, the GzRNM shaders are fantastic and the CRNM SSBump Diffuse runs very well on the iOS platform. The real beauty about the GzRNM mobile shader is that you're getting bump detail without dynamic lights! That's the benefit of the RNM shaders. Here is a screen shot of the scene running on my iPad.

    I hopes this helps those who have questions about these shaders running on iOS. If have any questions, let me know as I'd be happy to help.

    -Wes

     
  15. Geenz

    Geenz

    Joined:
    Sep 1, 2010
    Posts:
    99
    Mind posting a screenshot with just the lighting? :D
     
  16. wesrm

    wesrm

    Joined:
    May 20, 2009
    Posts:
    193
    @Geenz Sure! No problem : )

    Here's some screen shots of just the lighting. I removed the diffuse texture so you can get a better idea of the bump detail available for the mobile GzRNM shader. There's is no lights in this scene, yet you still get very nice bump detail!





     
  17. Geenz

    Geenz

    Joined:
    Sep 1, 2010
    Posts:
    99
    Now if PVRTC didn't look horrible :p
     
  18. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    On a shader side note, if you haven't watched Jesse's Shader Lab tutorial on YouTube do yourself a favor and watch it. Incredible amount of information in there. I have a pile of mobile optimized shaders (most from Jesse) here.
     
  19. Deleted User

    Deleted User

    Guest

    Thnx, i looked in to the wiki for "spherical harmonics", and it's exactly that kind of technique i thought of how it could work.
    the light information is not more than a picture which is maped spherically and the shining, based on the rotation of the spherical mapped light picture, reacts on the rotation of the object. a simple up and down.
    i understand the technique.... hm a pitty i am not able to write such a shader.

    thnx for the term.

    i don't see the use of the RNM shaders for iOS, if nothing happends on movement/rotation. or am i wrong? cause i wan't to try in the next couple of days to render the test scene with all the effects on a single texture to show the same results. 1 draw call, max frame rate
     
  20. Geenz

    Geenz

    Joined:
    Sep 1, 2010
    Posts:
    99
    The primary reason for CRNMs and SSBumps on iOS is to provide higher quality lightmapping that seems as if it interacts with self shadowing bump maps, without using alot of instructions.
     
    Last edited: Jan 2, 2011
  21. Deleted User

    Deleted User

    Guest

    but for what? aslong there is no change on the surface by rotating with the camera around it, its sensless and every complete baked single map would do the same feature. i started the test scene and the shaders where installed before i did that. i moved around the object, no effect, no gliding thing or anything else. 4 to 5 texture informations for nothing. i don't get the use of this kind of shader.
     
  22. Geenz

    Geenz

    Joined:
    Sep 1, 2010
    Posts:
    99
    If you were to compare regular, low resolution lightmaps against RNMs of the same resolution, then lightmaps would always have the upperhand in terms of performance, with RNMs having the advantage in terms of appearance when coupled with normal maps, and self shadowed bump maps. CRNMs and SSBumps only take one instruction to compute for intensity, with a second instruction to multiply color, accounting to two instructions for static illumination computation using SSBumped CRNMs. Anything else is just other ease of use "features" to make configuring the shaders easier.

    If all you want is dynamic lighting, then unity has the appropriate shaders built in for that, even if they may not provide high performance on iOS.
     
    Last edited: Jan 3, 2011
  23. Geenz

    Geenz

    Joined:
    Sep 1, 2010
    Posts:
    99
  24. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    thanks for sharing the roadmap, exciting stuff in there IMO!

    I'm reallllly looking forward to instructions on how to generate RNM's in blender3D, as the power of the shaders is not very useful to me at this point, soon that will change with a tutorial on how to generate RNM's in blender(or a script for blender better yet). I looked over the maya/modo pdf tutorial, good info there, but there are some steps that look like they might call for a couple days of trouble shooting pitfalls due to the differences in how blender generates normal coordinates(at the least), time I dont have this moment due to my current project milestones. Please, as soon as you can, post an even rudimentary breakdown on the Blender RNM generation process. 3D Ninja did a GREAT job on the tutorials for those other apps, but even a simple numbered-text-based step by step for Blender would be extremely useful at this point, thank you for understanding.
     
  25. Geenz

    Geenz

    Joined:
    Sep 1, 2010
    Posts:
    99
    Really, baking RNMs in Blender would be roughly the same as baking them in any other app.
    1. Assign unique Lightmap UVs to your mesh
    2. Assign one of the basis maps as a normal map to the materials in your scene (note: the basis map _MUST_ use the primary UV coordinate)
    3. Render the lightmaps to a texture using the lightmap UV
    4. Rinse and repeat for the other basis maps, easiest way to remember which basis map was used for what lightmap is to name the lightmaps after the basismaps (baked_objects_RNMX, baked_objects_RNMY, etc.)

    Right now, I'm working on a modified version of ExternalLightmappingTool that exports the current unity scene with beast's unwrapped UVs separated into lightmap channels for each lightmap index. This should help simplify the creation of RNMs in other packages. Hopefully, this will make it into 1.2's release, however I make no promises.

    1.2 will be a very big release. One that I'm currently debating offering a beta for to current (and future) customers.
     
    Last edited: Jan 7, 2011
  26. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    Perhaps a real quick and dirty screen cast would make this all completely clear for everyone...
     
  27. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    @Prime31(p.s. your Unity plugs rock!)

    +1 as the shaders I purchased aren't even usable at this point for me without the ability to generate RNM's in the software package my team uses, Blender(2.49 or 2.56x)
     
    Last edited: Jan 7, 2011
  28. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    please.... please.... a blender tutorial on generating RNM's, pretty please, super please
     
  29. Geenz

    Geenz

    Joined:
    Sep 1, 2010
    Posts:
    99
    I'm working on it :p Learning a different 3D package and how to do things in it that are for the most part different in comparison to wider used tools isn't easy.
     
  30. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    Thank you for the update, my team and I are very eager to use GZ RNMs in our iOS projects in development(purchase some more licenses too likely). :)
     
  31. ykk

    ykk

    Joined:
    Dec 8, 2009
    Posts:
    51
    Where can i find 3ds max documentation? I want to know the workflow of RNMs in 3ds max.
     
  32. ykk

    ykk

    Joined:
    Dec 8, 2009
    Posts:
    51
    How the workflow in 3ds max? Any tutorial or documentation?
     
  33. wesrm

    wesrm

    Joined:
    May 20, 2009
    Posts:
    193
    Hi,

    I created the original docs, but I only had access to modo and Maya. However, the process is the same for any 3D application. Check out the Maya walkthrough as this should help. The process is pretty much the same for baking a standard lightmap in max. In Maya, I used mental ray Batch Bake and max should have a similar setup. Here's the process.

    1. Create a new material in max, which you'll assign to the mesh. This material will be used to apply one the RNM Basis maps from the Snow Cat Solutions folder. These specific maps are used to transform you're mesh normals into a specific vector basis.

    2. In the new material, add the X RNM Basis map as a normal map set to tangent space. When applying this normal map, be sure that if you're using multiple uvsets, this maps uses the 1st uvset which should be the one used to map your color texture. You don't want to use the lightmap uvset. On this material, I'd turn off specular and reflection. Just use a Lambert shader.

    3. Apply this new material to your mesh. Overwrite the material currently on your mesh as we're going to bake the lightmap with this new material.

    4. Bake a lightmap just as you normally would. It's IMPORTANT that the lightmap targets the first uvset again. This uvset should be the set used to apply you're color map. Do not use the lightmap UVset. After the bake is complete, save the file as RNM_X. Naming isn't important. You just need to know this is the X RNM so you can apply it to the shader. For best results, save the file as EXR 16bit-half float.

    Now, you'll repeat the above steps. You'll need to simply substitute the RNM Basis normal map to the Y and Z maps found in the Snow Cat solutions folder. Remove the X Basis material you created in step 1 and apply the Y basis material and bake the Y RNM map. Same procedure for the Z RNM map.

    Now, you'll have the 3 RNM maps needed for the shaders. You can also compress these maps using the utility in GzRNM from Unity.

    I hope this helps : )

    -Wes
     
    Last edited: Jan 18, 2011
  34. wesrm

    wesrm

    Joined:
    May 20, 2009
    Posts:
    193
    Hi,

    I just replied to ykk's post. You may find this helpful as the process should be the same with Blender. It really comes down to applying a normal map and baking the lightmap. You simply do this for each for the RNM Basis maps found in the Snow Cat Solutions folder. I don't use Blender, so it's difficult for me to say exactly how to apply a normal map and bake a lightmap, but if you know these steps then all you need to do is apply the RNM basis maps as normal map and bake a lightmap as you normally would.

    Let me know if this helps : )

    -Wes
     
  35. Geenz

    Geenz

    Joined:
    Sep 1, 2010
    Posts:
    99
    What he's more looking for is a tutorial that outlines the workflow specifically for blender. Really, there's lightmapping tutorials for blender out there, and there's little different you'd do to bake RNMs in blender than you would for a basic lightmap (it's literally just adding a normal map to a material, baking, and changing normal maps).
     
  36. Geenz

    Geenz

    Joined:
    Sep 1, 2010
    Posts:
    99
    A bit of an update on GzRNM's progress.

    First off, GzRNM 1.2 is no more. We'll instead be going forward with GzRNM 1.5.

    In addition to GzRNM 1.2's original feature set, we'll now be including:
    • Vastly improved RNM specular shaders. Specular now actually looks like it's coming from the right light direction!
    • Some Unity 3.2 specific features (which will be revealed soon!)
    • A few tweaks to the shaders here and there in general
    There is one important point I'd like to focus on due to its visual impact. That's the new specular shading functionality.

    The old specular shading was computed in a highly inaccurate, yet similar to UDK, method. We basically did the following for specular shading:
    Code (csharp):
    1.  
    2. //Normalize our view direction
    3. half3 normViewDir = normalize(viewDir);
    4. //Create our specular basis based upon view direction and RNM basis
    5. const half3 specBasis[3] = {
    6.     normalize(normViewDir + _RNMBASISX),
    7.     normalize(normViewDir + _RNMBASISY),
    8.     normalize(normViewDir + _RNMBASISZ)
    9. };
    10. //Calculate our normal half vector for each basis
    11. float nh[3] = {
    12.     max(0, dot(o.Normal, specBasis[0])),
    13.     max(0, dot(o.Normal, specBasis[1])),
    14.     max(0, dot(o.Normal, specBasis[2]))
    15. };
    16. //Now compute the exponents, and multiply against each
    17. spec =  pow(nh[0], o.Specular*128.0) * RNMX +
    18.         pow(nh[1], o.Specular*128.0) * RNMY +
    19.         pow(nh[2], o.Specular*128.0) * RNMZ;
    20.  
    The above code produces 3 specular highlights, and produces results somewhat similar to UDK's lightmapped specular shaders.
    For GzRNM 1.5, I had an idea to effectively compute specular by multiplying each RNM against its corresponding basis, summating the products together, normalizing, and adding the view direction. The result is, we no longer have to compute 3 normal half vectors, and we no longer have to compute 3 exponents.

    Instead, we now only compute one half vector, and one exponent, and yet it appears as if specular highlights are coming from the appropriate direction in most cases, AND it results in a somewhat lighter weight shader!

    Here's some shots showing off this new technique:







    More info about 1.5 coming soon!
     
    Last edited: Jan 23, 2011
  37. marjan

    marjan

    Joined:
    Jun 6, 2009
    Posts:
    563
    Ok, so i was trying to get the RNM Example Package to run on the ipad. As the were really barebone, i extended the scenes with some camera controls, in scene1 i added a first-person controller, and in scene2, the Scene with the "trash yard", i added touch controls to spin the camera around the object and zoom in and out.

    To me it seemed, the scenes were already somewhat prepared for iOs, at least scene2 had the mobile/GzCRNMSSBump Diffuse attached.
    I changed the shader of the lightbulb to a mobile one, as Wes suggested. And finally i toggled of the one light completely (also that did not make a to drastic difference.)

    So, this scenes FPS on the iPad were between 60+ FPS and 13 FPS, depending on how close i zoomed in. Maximum Zoom showed the object larger than the screen, but due to the geometry it did not cover the screen totally. Lets say 80% to 90%.

    Here is a a profiler stat from that scene, totally zoomed out, no light:
    ----------------------------------------
    iPhone Unity internal profiler stats:
    cpu-player> min: 14.6 max: 33.5 avg: 20.9
    cpu-ogles-drv> min: 0.3 max: 0.4 avg: 0.3
    cpu-waits-gpu> min: 13.2 max: 31.7 avg: 18.7
    cpu-present> min: 0.3 max: 0.4 avg: 0.3
    frametime> min: 15.3 max: 34.3 avg: 21.1
    draw-call #> min: 5 max: 5 avg: 5 | batched: 0
    tris #> min: 2226 max: 2226 avg: 2226 | batched: 0
    verts #> min: 1244 max: 1244 avg: 1244 | batched: 0
    player-detail> physx: 0.1 animation: 0.0 culling 0.0 skinning: 0.0 batching: 0.0 render: 1.2 fixed-update-count: 0 .. 2
    mono-scripts> update: 0.1 fixedUpdate: 0.0 coroutines: 0.0
    mono-memory> used heap: 290816 allocated heap: 356352 max number of collections: 0 collection total duration: 0.0
    ----------------------------------------


    Scene 1 (The one inside a room showing 3 colored spheres and tiled walls) however was disappointing. After ending up switching all lights off, setting mobile/vertex color to the spheres and the rest to mobile/GzCRNMSSBump Diffuse.

    i get a mere 7FPS here. Stats on that one:

    ----------------------------------------
    iPhone Unity internal profiler stats:
    cpu-player> min: 128.9 max: 148.9 avg: 136.9
    cpu-ogles-drv> min: 0.4 max: 0.5 avg: 0.4
    cpu-waits-gpu> min: 126.6 max: 146.5 avg: 134.4
    cpu-present> min: 0.3 max: 0.4 avg: 0.3
    frametime> min: 130.3 max: 150.3 avg: 138.3
    draw-call #> min: 8 max: 8 avg: 8 | batched: 0
    tris #> min: 3620 max: 3620 avg: 3620 | batched: 0
    verts #> min: 3537 max: 3537 avg: 3537 | batched: 0
    player-detail> physx: 0.5 animation: 0.0 culling 0.0 skinning: 0.0 batching: 0.0 render: 1.4 fixed-update-count: 6 .. 8
    mono-scripts> update: 0.4 fixedUpdate: 0.0 coroutines: 0.0
    mono-memory> used heap: 258048 allocated heap: 356352 max number of collections: 0 collection total duration: 0.0
    ----------------------------------------


    This scene was actually not already set up for mobile, so i might have done something wrong or the textures supplied or not right. And of course here the Object covers 100% screen, so it´s just the max you can get. If so, i don´t see how to make use of these shaders on iOs right now, with the exception of a 3GS.
    Or should we only have some sparse objects using it here and there?


    If anybody else could share there results or shed light on how to speed this up, this would be great.


    Edit: Just for a speed test i dublicated the whole scene and put a standard diffuse specular on that. Added one directional light. This runs at 6 FPS. hmmm.
     
    Last edited: Jan 28, 2011
  38. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    any help AT ALL for generating RNM's in Blender would be REALLY appreciated. I'm looking forward to the day I can use the GZRNM shaders I purchased a long time ago. Thanks to anyone that can offer any insight/help :-(

    still nothing..... soon hopefully.....
     
    Last edited: Mar 3, 2011
  39. KnifeFightBob

    KnifeFightBob

    Joined:
    Jan 22, 2009
    Posts:
    196
    Bumping. Blender workflow or something like that would be extremely nice.
     
  40. Hans

    Hans

    Joined:
    Feb 20, 2007
    Posts:
    422
    how is 1.5 going?
     
  41. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    Geenz said he was going to opensource it, IMO which means I wasted my money. Pardon my "harsh" tone, but I've not been able to use this ONCE, because I use Blender, and have not been able to generate a single RNM.

    I put faith in the commitments to produce a tutorial release on doing so that has never come about(which is why I bought it). It happens, I'll be more cautious next time. I really wanted to generate RNM's in blender(with the tutorial that was supposed to be released), and use the GzRNM's. :-(
     
  42. garyhaus

    garyhaus

    Joined:
    Dec 16, 2006
    Posts:
    601
    FORGET IT... Here we go...
     
    Last edited: Mar 15, 2011
  43. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,790
    1) He didn't say anything here/officially yet, but you're already angry

    2) How does him opensourcing it affect you? Can't you use the shaders, like now, instead of in an undefined future date in which he will opensource the shaders?

    3) Also having read the docs for modo/maya, I don't see why you can't use the same method with blender.
     
  44. dadim83

    dadim83

    Joined:
    Dec 15, 2009
    Posts:
    16
    Hi! this shader looks truly interesting!

    I was really looking into wesm's build, but unfortunately it no longer seems to work.

    Would like to see a build before buying though. Could you provide one please?

    Thanks!
     
  45. the_gnoblin

    the_gnoblin

    Joined:
    Jan 10, 2009
    Posts:
    722
    Hello!

    What are the minimum requirements for PC to run these shaders?

    Is it possible to use another UV channel for color map?

    thanks,
    Slav
     
  46. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
    Where can I get these shaders?
     
  47. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    I paid for these filters, the least I could get in return for NEVER being able to use them, is a tutorial for generating RNM's for Blender(the tutorial I was promised would be released by Geenz, thus the reason I purchased these plugins). That would at least alleviate the dissatisfaction I have with the purchase I made of GZRNMs.

    I am aware he/she open-sourced them, but that does not alleviate the money I dropped on these shaders that I was never able to use, due to being promised that a Blender tutorial on generating RNM's would be released... ugh!
     
  48. marjan

    marjan

    Joined:
    Jun 6, 2009
    Posts:
    563
    i havent heard anything about this recently. People writing here about the shaders beeing open sourced but where? On his website is no word about that, the last Blog entry is for version 1.1. A Version 1.5 should have been in the works but never got finished it appears.
     
  49. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
  50. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    First, if you buy something early, and do not use it, you have paid for that right to use it early. The fact you decided to buy it early and not use it, is nobody's fault but yours.

    Don't give me any talk about "it was blender" or whatever. Check before the Check as I say.

    But... there is a silver lining in the cloud. If you paid for it, you helped everyone who got it for free. You financed it so to speak, so the rest of us are now in love with you, and love you very much for the free shader. Thanks!

    ps. I won't use this shader, I'm just saying who cares if it cost something or not, there's bigger worries to be had in life.