2 Questions, Multipass rendering? Linear filtering?

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
ShakeMeLikeABritishNanny

2 Questions, Multipass rendering? Linear filtering?

Post by ShakeMeLikeABritishNanny »

Ok, 2 quick questions. Is there a way to do either of these things, with out having to modify the source code of irrlicht?

The first is, is it possibly to do multipass rendering? Looking to implement Cel Shading, and need to be able to render an object once, then render it again with only the outline (2 passes).

Second, I want to have 2 textures in my material (which is possible), but I want the second texture to have this filtering
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
Is it possile to do this without also setting the first texture to this?

If either of these things are NOT possible, what advice would you have as a place to start looking in the source to add these things?
ShakeMeLikeABritishNanny

I think I might have it?

Post by ShakeMeLikeABritishNanny »

Ok, I think I might have answered my own question, possibly. What do you all think of this plan of action.

Inside the engine, I can declare a new material type "Cel", that disables bilinear filtering for the second texture in the setRenderStates3DMode() function, for each video driver type. Then inside of the actual rendering function, i have a material type check, that checks for "Cel" materials, if it is a cel material, it does another pass of rendering (setting the needed variables) then resetting them when finished. The only problem I see, is the possibility of changing the second texture from billinear, to linear. But as long as I change it back at the end of the rendering step, i dont think it will hurt much? What do you all think?

Or the OTHER way to do it, is simply to NOT use a second texture whatsoever, and simply change the vertex colors in a grey scale fashion. The problem with this is, you get a more uniform shading, instead of a nice hard "toon" shading.
ShakeMeLikeABritishNanny

Post by ShakeMeLikeABritishNanny »

Ok, I think I might have the OpenGL Cel shading material functioning. (Not sure yet, have yet to do a trial run, but later today maybe). But I was curious about DX. I am an OpenGL user, and DX is NOT a strong point for me. Does anyone know the DX equivilent of this?

glBindTexture(GL_TEXTURE_2D, textureName);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

In opengl, you must bind the texture before you manipulate its properties. In order for Cel shading to work "correctly" you must turn off linear filtering, to get the "bands" of shading. Anyone know the DX equivelent of that? Also, how does one turn of blending in DX??
Phunk
Posts: 78
Joined: Sun Dec 14, 2003 8:18 pm
Location: The Netherlands

Post by Phunk »

hmm, just got started learning directX(to implement cubemapping, still coming soon!!!) but isnt blending just the type of material? so if you'd turn off gourad shading, or do you mean something else? I found that when you understand the way the engine renders things(and it sounds like you do), that it is fairly easy to just cut & paste from the examples from the directx sdk(or whatever source) the bits that you need. That is as far as I can help you. Unless the way directx renders is totally diffirent, then I could explain the structure of how directx is used in irrlicht(well some of it). But It's kinda a complex story to write, so you'll have to say first if this is what you want, ok?
keep up the good work! maybe we(me cube/bump-mapping, you cell shading) can help extend the features from irrlicht a little, and thus help niko developing the engine

Greets, Robin
Post Reply