Darkplaces engine dp_reflect on models bug

Discuss programming topics for the various GPL'd game engine sources.
Post Reply
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Darkplaces engine dp_reflect on models bug

Post by toneddu2000 »

Did everyone face this problem once? With DP, if you add a shader with dp_reflect like this:

Code: Select all

textures/office/ashtray
{
	qer_editorimage textures/office/ashtray.tga //thumbnail in radiant editor		
	dp_reflect 0 1 1 1 1
	{
		map $lightmap		//needed by realtime light too!
	}
	{
		map textures/office/ashtray.tga
		blendFunc GL_DST_COLOR GL_ZERO
		rgbGen identity
	}
	{	
		map textures/office/ashtray.tga
		blendfunc GL_ONE GL_ONE
	}
}
Then set r_water to 1, and apply it to a wall, no problem. Reflection is nice and easy. BUT, if you try to apply the same shader to a model (in my case a .obj model) all the scene goes crazy. The floor with the reflection shader applied is reflected only when the player visual is between some degrees (a very low angle, btw) and the model is using some kind of weird reflection (it reflects things that, for its angle, shouldn't be reflected).
I think it's an engine bug. Do you think could I be right?
Meadow Fun!! - my first commercial game, made with FTEQW game engine
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Re: Darkplaces engine dp_reflect on models bug

Post by leileilol »

Reflections are for single plane surfaces on maps. Don't even try it on models. This is not an engine bug. If it were "fixed" it would end up rendering the scene as many times as the model has polygons which would be unbearably slow.

Instead use a reflect cubemap to fake a reflection effect. It's what the games industry does.
i should not be here
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: Darkplaces engine dp_reflect on models bug

Post by toneddu2000 »

Reflections are for single plane surfaces on maps. Don't even try it on models. This is not an engine bug. If it were "fixed" it would end up rendering the scene as many times as the model has polygons which would be unbearably slow.
Ah, ok. I'm anyway curious if there were some sort of "approximation" feasible for limiting the depth of reflections and to share same reflections by adjacent faces :)
Is it possible to convert static models to ASE with q3map2 command line commands? Maybe in this way it could be possible to do it! (I know it would be slow but I'm just too curious to see how it looks like! :D )
Instead use a reflect cubemap to fake a reflection effect. It's what the games industry does.
yeah, thanks leilei, I was thinking about this common approach. Can you please tell me if this is the correct syntax for cubemaps shader:

Code: Select all

{
        blend gl_dst_alpha, gl_one
        maskalpha
        cubeMap env/cmap1
        red     Parm0
        green   Parm1
        blue    Parm2
        texgen  reflect
    }
Meadow Fun!! - my first commercial game, made with FTEQW game engine
Post Reply