override material - help

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
WarLocker
Posts: 3
Joined: Fri Aug 14, 2009 8:49 am

override material - help

Post by WarLocker »

Hi Irrlichters!
I'm working on shadows now and I desperately need to render my scene without any textures at all to get a depth pass.
I've already prepared a shader for that, but I can't get override material to work, here it is:

Code: Select all

  SOverrideMaterial oMat=driver->getOverrideMaterial();
   oMat.Material.MaterialType=(video::E_MATERIAL_TYPE)mtlToonShader;  // that's the material I want
   oMat.EnableFlags=EMF_LIGHTING;//what do I need to..
   oMat.EnablePasses=EMF_LIGHTING ;// set HERE?
please HELP and thanks in adwance
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

Hi,

You can't override MaterialType param. In EnableFlags You must put all material flags (E_MATERIAL_FLAG), which should be override, but in EnablePasses You must put all scene node types (E_SCENE_NODE_RENDER_PASS) which should be override.

Eg. if You have to disable lighting for solid and transparent nodes:

Code: Select all

driver->getOverrideMaterial().Material.Lighting = false; 
driver->getOverrideMaterial().EnableFlags = EMF_LIGHTING;
driver->getOverrideMaterial().EnablePasses = ESNRP_SOLID+ESNRP_TRANSPARENT;
Hope this helps,
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Post Reply