You can use a one instruction line : diffuseColor = tex2D(g_TopSampler,IN.UV0.xy);diffuseColor = (diffuseColor != 0) ? diffuseColor : float4(1,1,1,1); the ?: translates to 1 asm instruction
In case it helps, here's a quick pseudocode description of CrazyBump's shader (with parallax displacement omitted). All the vectors are in tangent-space. DiffuseColor = DiffuseTexture * (LightVector DOT NormalVector) SpecularColor = SpecularTexture * (HalfVector DOT NormalVector) ^ Gloss OutputColor = (DiffuseColor +…
Ben Apuna, its simple. If you are baking your lightmaps in a 3d package like max you can setup your lighting so it looks how you want it, then when you actually bake the lightmaps bake them 2 or 4 times darker than they were when you were preview rendering. You could probably do this easily with some exposure control in…
I'm getting the same issue with swatches.fbx from Quixel Suite 1.8, but with Blender. i.e. in the swatches provided for photoshop (Swatch.aco), the color for Varnished Wood is #c85300, but in the FBX file once imported into Blender, the color is #E59B00 which results in "Undefined" in Ddo. I converted swatch.fbx to ASCII…
I would use a simple approach. Basically all you have to do is : ( 1 - glossiness ) * numofmipmaps. In my case it's 7. My setup : If your are using phong or blinn you might want to multiply your glossiness by 128 in order to get a range of 0 - 1 to avoid value like 180 or 200. But with a cook torrance or a spherical…
Here's some comments. [COLOR="Green"]--NOTHING WRONG WITH THIS LINE, EXCEPT IN MAXSCRIPT IF YOU HAVE AN ELSE CLAUSE YOU NEED TO USE "THEN" NOT "DO"[/COLOR]for obj in selection do[COLOR="Green"]--THE BRACKET DOESN'T NEED TO BE DOUBLE UP[/color] (([COLOR="Green"] --YOU DON'T DECLARE VARIABLES IN MAXSCRIPT OR END LINES WITH A…
LoL this makes me mad. I dont know if it is this hlsl compiler or max but it is crazy. I've put my code into some fancy functions like Xoliul did, to get a better overview. But instead working like before as I would expect it, it does not I've got no compile errors or anything else, but my specular calculation doesn't work…
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:…
The flag animation is just a simple 'vertex offset' shader with a panned gradient texture and the same texture is used for multiplying/darken the diffusecolor for fake shading. No 'use' of 'normal reconstruction'. I hope you like it! :)