Game Development Community

Applying a custom shader

by Martin Ortiz · in Torque Game Engine Advanced · 02/05/2007 (12:47 am) · 7 replies

I've been reading around on shader in TSE, and among the various faqs, I haven't found out how to actually apply a new custom shader...

I've read about grabbing the vertex/pixel shader out of rendermonkey etc...creating new ShaderData, how to feed it the appropiate info (world view...eye view...etc...etc....)

but where is the info on how to apply it? Is this done in Torque script? or in C++? or both.

Is there a start to finish tutorial?
(start in rendermonkey---->finished app example)


One of the problems with the Torque docs, is that there are so many missing holes, things that are obvious to somebody who's familiar with the engine, but takes digging to find out what to do.

#2
02/07/2007 (3:02 pm)
Yes, I saw it
(in a nutshell it covers)

1) Copying shaders to shaderV.hlsl and shaderP.hlsl files.
2) Creating ShaderData definition in shaders.cs
3) Creating CustomMaterial definition in materials.cs
4) Connecting Torque output to shader inputs

But (again, I'm a noob, so this doesn't seem obvious to me, but may be to those who are familar with SDK/engine)


Here's the step I'm not seeing...how to apply this custom material/shader?

ie....here's a typical art pipeline...
(let's assume steps 1-4 above have been done in regards to vertex + pixel shader code)

5) I model X (X = anything) in Maya
6) I export X
7) ok...here's the gray area....how do I import X into engine? Is "importing" done by placing it in a sub-folder?
because World Editor, doesn't have any file dialog (that I see) for selecting + importing a model.
8) now, let's say we "imported" X (again, I need clarification on how this is done via World Editor)
how do I....
a) determine what material/texture/shader it is using?
b) substitute a new material/texture/shader?
#3
02/07/2007 (3:12 pm)
Search "Basic Shader" you will see a resource where I make the most fundamental changes to a shader.
#4
02/07/2007 (4:00 pm)
Re your tutorial (saw it)

on your last step....
Finally add change the binding of the SpaceOrc <----- This is what I am looking for...how is this done?

via World Editor? via Torque Script? via C++?
I went and did a file text search, on the common shaders, and could not find in the scripts or C++ how the shaders are applied to specific models?
#6
02/08/2007 (4:26 pm)
That was the info I was looking for
#7
10/22/2008 (12:03 am)
Sorry but any1 can let me know how to "Finally add change the binding of the SpaceOrc" with the CustomMaterial ?