Sign in to follow this  
edwinbradford

Game engine preview in 3D applications?

Recommended Posts

Hi everyone, I've followed a great normal mapping tutorial at http://www.monitorstudios.com/bcloward/resources_tutorials.html. Where I'm confused is in real time previewing in 3D applications (in my case Maya). I've generated a simple .dds Normal Map from a plaster texture in Photoshop using Nvidia's Photoshop plug in and now I want to preview that map as it would appear in a game engine. Is the following true? 01. The best way to do this is either by the real time ASHLI or CGFX shader plug-ins? ASHLI supports .fx shaders and CGFX supports .cgfx shaders. 02. ASHLI is an ATI product and CGFX is a NVidia product? (Does either one have wider developer support)? 03. Shaders are written in third party products like FX Composer (Nvidia) and Render Monkey (ATI). They use a scripting language called HLSL. 04. In a commercial environment the programmers would have a shader for the type of texture an Artist has to produce and each category of textures might have a different shader? So a "game engine" has several shaders? 05. If you don't have a pre-made shader then the best solution is to find a generic "default" shader instead. If anyone can answer any of these questions it would help my understanding of this greatly. Many thanks.

Share this post


Link to post
Share on other sites
Its actually really easy in Maya to preview your normal map. Just create a normal material (Phong, Blinn, Lambert, etc), assign your normal map to a Bump node and the bump node to the material's bump channel (like you were making a regular bump map), change the setting of the Bump node from 'Bump' to 'Tangent Space Normals' and change your viewport shading mode to 'High Quality Rendering,' press '6' to make sure Hardware texturing is on, and voila!
There is also a plugin available from highend3d (called truebump2D or something like that) that you'd use instead of a normal bump node if you wanted to render. It also allows you to change the normal map height, flip the green channel, etc.
As far as actual engine shaders, as far as I know its not possible to transport shaders back and forth. As far as I know, shaders are pretty engine-specific, so its not easy to export and import them (though some engines probably have the capability). Maya shaders are written in MEL I think, so there'd need to be some language translation, which is not easy. A better route IMO is just to simulate the material shader (shaders can be many many things, in this case we're just talking about textures and materials) using a Blinn, Phong, or Lambert Maya shader (ie, set the specular rolloff, eccentricity, diffuse, etc) and use High Quality Rendering view mode, or alternatively (and especially at later stages) just check your texture in the actual engine.

Share this post


Link to post
Share on other sites
Hi again 420,

I'm going to try it out later today, that's great. I looked everywhere for an answer like that, Maya help files, googling, the lot. Just couldn't get an answer. I knew there had to be some way, all the tutorials I could find pretty much cover Normal mapping as it applies to baking.

Thanks for the shader overview too, I'm starting to get my head around it, and your advice to just simulate the surfaces with Maya shaders is pretty much what the mod team leader / developer has just suggested, I like it because it's nice and simple.

By the way, I'm really getting used to my PC now, it's a lot more stable now and Maya is working superbly on what's a purpose built machine.

Share this post


Link to post
Share on other sites
Quote:
Original post by edwinbradford
01. The best way to do this is either by the real time ASHLI or CGFX shader plug-ins? ASHLI supports .fx shaders and CGFX supports .cgfx shaders.

02. ASHLI is an ATI product and CGFX is a NVidia product? (Does either one have wider developer support)?

03. Shaders are written in third party products like FX Composer (Nvidia) and Render Monkey (ATI). They use a scripting language called HLSL
Actually, if you're using OpenGL, ASHLI also supports GLSL. Which you use is largely dependant on which shader language you plan to use. For DirectX, it's either HLSL or Cg (which is very similar, but not identical), and for OpenGL it's either GLSL or Cg.

Quote:
04. In a commercial environment the programmers would have a shader for the type of texture an Artist has to produce and each category of textures might have a different shader? So a "game engine" has several shaders?

05. If you don't have a pre-made shader then the best solution is to find a generic "default" shader instead.
I wouldn't say it's quite so simple. There are lots of different shaders, and they mostly vary on more technical details that are separate from the particular texture on a model.

In general, most games share a single default shader that essentially defines the basic light-model (ie. per-pixel normal mapping with specular highlights from n lights and diffuse lighting from m lights w/ an ambient occlusion factor). From there you will customize it in various ways for different hardware, models (static or animated), variations for special effects (glowing), and so forth.

Usually an entire model is shaded using a single shader (for performance reasons, it is best to reduce the # of draw calls), with constants being used to allow the artists to tweak the effect.

There are also a variety of special-case shaders such as post-process shaders (among others), but those generally can't be used externally.

Share this post


Link to post
Share on other sites
Thanks for the info. We are using OpenGL as I understand it, I'm going to stick with blinn, lambert standard renders to start with as 420 suggests and then come back to ASHLI and CGFX later once I've a better understanding of how everything fits together.

Thanks for filling the gaps in my knowledge, it's a big help, trust me.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this