Hey gang,
I've been working on my own multipurpose CGFX shader for Maya for a while now. Figure I'd let the PC community give it a go. I created this shader using Mental Mill and a bit of notepad editing for UI tweaks. The purpose of this shader is to produce a "game like" look in Maya's viewport.
I haven't been arsed to write any documentation for this yet, so just ask away. Please let me know if you find any bugs or have any suggestions for improvements.
You can get the shader here (bottom of page).Video Tutorial on how to use it here.![koddeshadershowcaseexam.jpg](http://img407.imageshack.us/img407/3544/koddeshadershowcaseexam.jpg)
Replies
ps after looking in to it more i think you need to add tiling controls to make this more useful, as the maya nodes wont work with it last time i checked, i can also detail how to do this proper in mental mill but im sure you've already figured it out, but would be great to tile the diff, spec, nrm and also i think it could have support for detail nrm maps. oh and props for the second uv set support, that could have been easily overlooked.
hijak> Mental Mill is loads of fun, but still lacks a few things. The emissive is just additive? The "glowish" fade is in the emissive bitmap, not generated by the shader. So it's nothing really fancy.
You know how to get transparency working? I'm quite limited to what Mental Mill lets you do since I don't know how to write a shader in a textbased editor, and I don't think MM gets you transparency. Also no shadows yet and no vertex color support.
Please do share how to get transparency working.
http://forum.mentalimages.com/showthread.php?t=160&highlight=transparency
id just hook it up with a conditional as well like you've done in these others.
also good to know is down there at the bottom is where you can control support for various features of these shaders, so experiment with that, its also very useful for changing what shader model is used.
unfortunately maya's hlsl and cgfx runtimes dont handle transparency very well or consistently, its just the nature of the beast.
even more disheartening, unlike max, maya wont let you do cool multipass shaders either so shadows are out. hopefully we will get more comprehensive support for this stuff from Autodesk since its becoming so useful in production. but I think hell will freeze over before Autodesk listens to the community.
Thanks!
Getting transparency and shadow to work are my two top features on my wish list, but both have seem hopeless. I'm going to try hijak's tip tomorrow evening, see if I can get that transparency workaround to work.
I messed around with trying to get alpha to work yesterday with that workaround but with no success. I had some funky transparency going on, but I couldn't get it to work correctly. I also found some other forum posts regarding this with people who said they had got it to work, but I couldn't get their solutions to work either
Starting to think it might be dependent on what version of Maya you use, or possibly even your graphics card and driver.
Thanks for sharing them with us
Probably a newbie error (and yes I watched the video from cgbootcamp and that shader doesn't work for me either).
I'm used to ignoring the pink/purple error message about internal lights, I always get that when loading a project or when I reload my .cgfx file in the shader. It works anyhow.
What sounds alarming in your case would be that you have tried a tutorial which also didn't work. Try updating your GFX drivers. Try on another computer if you have the possibility.
I know for a fact that my shader works on several different computers with different hardware. Though there is probably some scenario of hardware and driver combination that won't work. I know that there was a a quite common issue with Brice's Generic BRDF shader and certain drivers which wouldn't work. Many users had that issue. At that time I had to rollback to older drivers to get it working, now it works with the latest nvidia drivers though.
[ame]
Anyone know how to solve this? Would be cool to include parallax mapping in the shader.
Yeah you are probably right with the space conversion suggestion, but I wouldn't know where to start. I have also noticed the issue with amount that you are mentioning, most certainly depends on the implementation. My colleague spoke of other methods of doing it which produces "faaar better results", but I'm not sure if these would come with a trade off or if there might be an other reason for it to act like this.
I found what it was tough: you need to force sampler states on everything, never assume the default states are used 'by default' (how ironic). In my case the 'clamp' flag supplanted the 'wrap' one on some textures where it was left blank.
Aha... well there you go. Then maybe it isn't as common as one would think that the gfx drivers is to blame?
Also got a lot of help from hijak to get transparency working, yay! So will include this in next version.
-Changed old "Color_Texture" variable to "Diffuse_Texture".
-Transparency technique now available. Uses alpha channel of Diffuse Texture.
-Rim Lighting added. This is the "Ext_rimlighting" Mental Mill nodes added, no modifications on my part.
-Added 1 point light and 4 spot lights.
-Reworked how the Tint Ramp was added to the shading branch, should work better now.
-Ambient Color can now be set. Only works when not using a Cube Map for the ambient light.
-A couple of various small UI and cosmetic changes.
Go get the new version here. At bottom of page.
Here's my new feature images to convince you artsy folk out there
EDIT: I had a play and its really good! Thanks mate!
just a question, How do I hook up lights to it?
Anuxinamoon> After all the texture slots, at the bottom of all the parameters you will have a long list with all the light attributes and slots like "Directional1 Direction", etc. You need to have an object in your scene to define direction and/or position for the lights.
For example, try creating a new directional light in your Maya scene, then go to the shader and find the "Directional1 Direction" slot, right click in the empty slot and select your new directional light. Now you should be able to rotate the directional light in your scene and the light should update on the object. You can of course tweak parameters such as intensity, color, etc for each corresponding light. All light settings are stored in the shader. By the way, don't scale the lights in Maya.
I thought I was doomed to have bad real time shaders for the rest of my maya existence before your shader came along. Its really helped me out. So a big THANK YOU from me
Please do share any cool results you might achieve
Which is the "texture not found color"? Did you switch to hardware shading (6-key)?
Did you ever get any other CGFX-shader working in 2008? Did you try opening the ones bundled with Maya? In the presets folder.
MAYA_ENABLE_HWR_CG_PROGRAMS = 1
that may help, ive had to use that before think some older versions of maya have this problem where it would not detect your hardware as compatible, only seemed to happen when you where using consumer level hardware, as appose to workstation cards, but newer version of maya seem to not have this problem.
also make sure your using textured mode, the shader will show up green in shading mode and in textured mode it will be pink if there are no maps applied.
problems only occur with issues outside of maya's influence. Either the graphics card - your card must usually support shader model 3 (SM3) for these more complex shaders, or unfortunately user error.
You must be in 'Textured' Mode and NOT in 'High Quality Shading' Mode. Also lights must be linked into the shader - often times shaders are written to expect Texture Maps and must have some basic ones inserted. In general its a complicated process for a first timer.
**Changes in v0.3 since v0.2**
-Rimlight now uses Normal Map
-Half-Lambert now uses Normal Map
-Set diffuse color, affects even when a diffuse texture is loaded.
-Reflections Gain
-New Rim Lighting instead of old one which was more of a Back light.
You can get the shader here (bottom of page).
Tried it on this power drill I'm making.
Still working on the textures, and I'm using the same texture for spec, gloss and reflectivity right now.
Added the bloom in PS :P
Update:
Looking good Ivars. So rewarding for me to see people using it
Don't hesitate to ask if there's any uncertainties or questions regarding the shader.
**Changes in v0.4 since v0.3**
-Parallax Mapping!
-Choice to include specularity and reflections on transparent surfaces.
-All lights have a "Enabled" checkbox now to easily enable/disable them without having to alter their intensity attributes.
-Minor cosmetic change in order attributes are listed. The ambient lighting oriented attributes and slots are now further down, where the other light attributes are found.
You can get the shader here (bottom of page).
[ame]
that parallax is awesome. I can't wait to play with this shader- I've often felt like the unloved ginger freckled child as a maya user for realtime stuff, but this will help maya feel a little loved again!
~P~
Also try assigning a direction/position to your light and move it around, see if it works the way you expect it to.
Remember that if you do change the default diffuse color and later assign a diffuse texture your results will be diffuse texture color * diffuse color. In this case you probably want to set the diffuse color back to white.
New version out, v0.5. Quite boring update, but still necessary.
**Changes in v0.5 since v0.4**
-Fixed Diffuse Color and Light Colors working correctly with Warp Diffuse Ramp.
You can get the shader here (bottom of page).