Home Technical Talk

Maya HLSL Shader - lcNextGenShader.fx

polycounter lvl 10
Offline / Send Message
chronic polycounter lvl 10
I'd like to share with you a real-time HLSL Shader for Maya’s Viewport that I wrote as part of my exploration into the wonderful world of HLSL.
Try it out, and if you like it, let me know!

Updated - 11/30/2009: lcNextGenShader_1.2.fx

Updated: lcNextGenShader_1.15.fx

My Original Blog Post

lcNextGenShader_1.1.fx

Download: lcNextGenShader_1.1.fx
Sample Cube Map: default_env_map.dds

lcNextGenShader_exampleT.jpg

lcNextGenShader_interfaceT.jpg

Texture Support: the most compatible formats are tga and dds (other 8 bit formats may work - no guarantees)

Techniques:

NextGen_SM3 – full shading (requires shader model 3 capable graphics card)

Diffuse_Texture_Only – only the diffuse texture or color, without any other effects

Normal_Map_As_Color – only the normal map color values (helps to find seams)

Specular_Only_SM3 – only the specular effects, light and specular map contributions (requires shader model 3 capable graphics)

Parameters:

backFaceLighting – for single sided polygon objects, the back sides will be lit correctly

ambientColor – a color ‘added’ on top of the final effect

diffuseColor – the Lambert diffuse shading color

specularColor – the Phong specular shading color

glossiness – controls the size of the Phong specular highlight

useDiffuseTexture – use the diffuse texture from ‘diffuseMap’ instead of diffuseColor

transparencyInDiffuse – use the diffuseMap’s alpha channel for transparency

specularInDiffuse – use the diffuseMap’s alpha channel for specular masking

diffuseMap – a diffuse texture

useNormalTexture – use a tangent space normal map texture

specularInNormal – use the normalMap’s alpha channel for specular masking

normalPower – intensity of the normal map effect, 0=no effect

flipGreen – invert the green channel of the normal map (default = true)

normalMap – a tangent space normal map texture

useSpecularMap – use a specularMap for specular coloring and masking

specularMap – a specular texture for highlight coloring and masking

useAmbEnv – use cubeEnvMap for ambient environment lighting – cube map is forced down in mip levels – make sure to use a cube map processed by ATI CubeMapGen for proper filtering

ambPower – intensity of the ambient environment lighting – also multiplied with the ambientColor

useReflEnv - use cubeEnvMap for environment reflections

reflPower – intensity of the environment reflections (has a slight hardcoded Fresnel effect)

cubeEnvMap – a cube map – preferably one processed by ATI CubeMapGen for proper filtering

useGlowTexture – use glowMap for self illumination effects

glowPower – the intensity of the self illumination effect

glowMap – a texture that is ‘added’ on top of the final shader result – self illumination/incandescence

useLightFalloff – use falloff on the point lights

decayScale – scale of the light falloff for the point lights

Light1 is a directional light, lights 2 and 3 are point lights


Note: There are some issues with overlapping transparency planes in Maya’s viewport when using realtime shaders – unfortunately this seems to be a problem with Maya and not the HLSL code itself – so there is no fix available.

Replies

Sign In or Register to comment.