This project is read-only.

Multiply Materials?

Jun 19, 2013 at 5:13 PM
Edited Jun 19, 2013 at 10:14 PM
I want to render the scene with one material and then with a second material config.

XNA has something like passes and effect files. Not a big fan of effect files, but how can i solve this in Hieroglyph 3?

My target is to render the scene like i do and then render the full scene again but with a different shader, which produces an obstacle map for the shadow calculation.

i think it should be called multiply effects or?

The constants like VT_LIGHTS are hardcoded. Are there difference which constant i use for my purpose inside the engine?

material->Params[VT_LIGHTS].bRender = true;
material->Params[VT_LIGHTS].pEffect = this;
Jun 20, 2013 at 12:04 PM
Currently the material has an array of MaterialParams objects (which each contain a RenderEffectDX11), and the array is sized to match the VT_* enumeration size. Each one of those can be filled with a render effect for a different type of SceneRenderTask. As you mentioned, they are currently hardcoded, which is something I have considered in the past to change and allow for dynamic specification of the ID to MaterialParams mapping. That would take a bit of work, as this is one of the most widely used interfaces in the whole engine though (which is probably why I haven't changed it just yet...).

As a short term work around, you could just hijack one of the VT_* enumeration that you aren't currently using. For example, your first pass could be configured in the material for VT_PERSPECTIVE, and your second pass could be configured on the VT_SIMULATION enumeration. Then in your scene render task class you would render the scene once passing in the VT_PERSPECTIVE enum first, then repeat it with the VT_SIMULATION enum second.

I think this would do what you are looking for at the moment. Other solutions would be to create a new MaterialDX11 subclass that draws the same VT_PERSPECTIVE multiple times. This would move the multiplication from the scene level down to the object/entity level, which would give more control - but I don't think this is what you are looking for (at least from the description above...).

Do you think this might work for you?
Jun 20, 2013 at 6:28 PM
Thanks for the explanation.

Ive used one of the VT_ for my purposes. It woks well.