Author : Nate Broach


Reply
Reply
 
Thread Tools Display Modes
choco's Avatar
Old (#1)
Hey there,
I'm currently looking into using litsphere shading as a method for texturing.
The goal here is to use "decals" which has a normal map applied to it with an opacity mask.
Using lit spheres would allow me to reproject the normal map and create unique textures by putting together a bunch of decals in maya.
The output texture would be then extracted through a hardware render from an orthographic camera.

The hardware 2.0 engine in maya allows me to also extra an ambient occlusion map (SSAO technique) in realtime and also transparency with multi-sampling.

I'm currently looking into modifying the shader to add support for alpha based transparency stored either in the color texture or in the normal map (alpha channel).
I would greatly appreciate any pointers regarding the direction I should be taking.

As of now, I'm no tech artist but I'm looking it learning how to author my own cgfx/hlsl shaders which I would gladly share with the community.

The shader I'm currently using is made by Leonardo Covarrubias (blog.leocov.com)

Links to download the shader :
Icreproject (advanced litsphere/reprojection shader) : https://dl.dropbox.com/u/53969153/li...cReproject.zip

Simple litsphere shader : https://dl.dropbox.com/u/53969153/li...phere_1.1.cgfx

Here is an example of usage with a normal map litsphere :

Litsphere used : swizzle +X, +Y, +Z




A few test with some low poly brick stones which has a normal map baked into it :




Shade map (SSAO + simple litsphere) :




Failed attempt to use with objects which has transparency (decals method) : AO was turned on to see two planes.

Offline , triangle, 286 Posts, Join Date Aug 2008, Location France  
   Reply With Quote

Drew++'s Avatar
Old (#2)
I would test out a shader I just re-wrote, but I don't have Maya... but it needs just an alpha map(mask) somewhere, then you set the alpha in your main pixel shader function to use that map. Then in the shader 'pass' you would enable alpha test or alpha blend. I'll message you and maybe we could get this working :P
Offline , spline, 156 Posts, Join Date Oct 2009, Location Dallas, Texas Send a message via Skype™ to Drew++  
   Reply With Quote

haiddasalami's Avatar
Old (#3)
Hey Choco

I just changed

Code:
float  Oi = 1;
to

Code:
float  Oi = ungamma22(tex2D(litSphereMapSampler, UV).a);
Basically stripping and using the alpha of the color texture (since this is a lit sphere, maybe using the alpha of the normal might be better and more convenient (?)) and changed the technique to alpha test.

Here's the modified shader. Its pretty simple and basically what Drew mentioned. If you want to learn more about shaders, HLSL, CGFX etc check out Ben Clowards DVD's on CGAcademy. They're written with HLSL and if you want CGFX check out Luiz's DVDs on Eat3d. Let me know if you wanted more info etc. Also definitely a useful thing to do!

Last edited by haiddasalami; 07-27-2012 at 06:42 PM..
WebGL Project - In a state of constant flux so might be down when you check it. Pretty old now.
Junior Technical Artist at Digital Extremes.
Offline , dedicated polycounter, 1,856 Posts, Join Date Nov 2009, Location Toronto  
   Reply With Quote

Drew++'s Avatar
Old (#4)
Yeah, I went ahead and re-wrote the shader, we're working on adding some cool stuff now on Skype ^_^
Offline , spline, 156 Posts, Join Date Oct 2009, Location Dallas, Texas Send a message via Skype™ to Drew++  
   Reply With Quote

choco's Avatar
Old (#5)
Thanks for the help guys, drew got it working like a charm, he rewrote the whole shader.
Only thing left is to get alphablend technique to work with the hardware engine of maya.
Currently it only works with the default rendering engine which doesn't render in software mode.
Offline , triangle, 286 Posts, Join Date Aug 2008, Location France  
   Reply With Quote

haiddasalami's Avatar
Old (#6)
Yeah thats gonna be hard as to my knowledge the hardware renderer isn't exposed to the cgfx shader/plugin (Other materials have a Hardware Texturing where you can change to combined to see the whole thing, alpha and all that jazz)
WebGL Project - In a state of constant flux so might be down when you check it. Pretty old now.
Junior Technical Artist at Digital Extremes.
Offline , dedicated polycounter, 1,856 Posts, Join Date Nov 2009, Location Toronto  
   Reply With Quote

choco's Avatar
Old (#7)
Maybe using a secondary pass to render transparency could be the solution, I'm not sure tho.
Offline , triangle, 286 Posts, Join Date Aug 2008, Location France  
   Reply With Quote

CheeseOnToast's Avatar
Old (#8)
Hey guys, I'm looking for the updated shader that Drew made. Basically, I'm looking for an easy way to create foliage planes using alpha-mapped leaves as my highpoly source for normals and transparency. Litspheres are great for rendering to a plane, but I can't get the alpha working.

Any help would be appreciated.
Offline , polycounter, 847 Posts, Join Date Dec 2004, Location Edinburgh, Scotland  
   Reply With Quote

haiddasalami's Avatar
Old (#9)
Hey Cheese

Are you just using the hardware render like Choco for the alpha? AFAIK Drew and Choco made this shader One option you can do is using Maya API to render the scene.

Last edited by haiddasalami; 01-18-2013 at 07:57 AM..
WebGL Project - In a state of constant flux so might be down when you check it. Pretty old now.
Junior Technical Artist at Digital Extremes.
Offline , dedicated polycounter, 1,856 Posts, Join Date Nov 2009, Location Toronto  
   Reply With Quote

CheeseOnToast's Avatar
Old (#10)
Thanks man, but AFAIK that shader doesn't support litspheres. I'd like to be able to apply a normal map litsphere like the one choco posted above and also an opacity map. I could then render my highpoly branch + leaves from an orthographic camera to get a really quick and easy normal map out.
Offline , polycounter, 847 Posts, Join Date Dec 2004, Location Edinburgh, Scotland  
   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Copyright 1998-2012 A. Risch