[FTE]v5221 dynamic light issue

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

[FTE]v5221 dynamic light issue

Post by toneddu2000 »

Hi guys,I noticed that in version n.5771, FTE has a brand new cvar dynamiclight_spawnstatic that works well (no performance differences with dynamiclight_add() though) but now dynamiclight_add flickers like hell, it's like it goes on and off every frame. Plus light brightness goes completely crazy

It's difficult to understand flickering with just an image(!) but trust me. The effect is very strong with low brightness lights
this is v5220
Image
this is v5221
Image

You could say: uhm..they're quite..they're the same!!
No, because the effect goes away when I switch to Windows snapshot tool to take the picture(alt + tab in fullscreen mode), in this case light seems normal

take a look instead when I use windowed mode with vid_fullscreen_standalone 0(that, for some reason, it doesn't work anymore when set in .cfgs)
Image
The issue is quite obvious: light it's overbright

This is an empty csqc-only project with just this minimum code

Code: Select all

entity testobj;
void CSQC_Init(float apilevel, string enginename, float engineversion)
{
	testobj = spawn();
	setorigin(testobj,[0,0,128]);
	precache_model("models/cube.iqm");
	setmodel(testobj,"models/cube.iqm");
	testobj.drawmask = MASK_ENGINE;
}
//
void CSQC_WorldLoaded(){}
noref float CSQC_ConsoleCommand(string cmd){return TRUE;}
float CSQC_InputEvent(float evtype, float scanx, float chary, float devid){return 0;}
void CSQC_Input_Frame(){}
//
void CSQC_UpdateView(float vwidth, float vheight, float notmenu)
{
	clearscene();
	setviewprop(VF_ORIGIN,[-400,0,400]);
	setviewprop(VF_ANGLES,[45,0,0]);
	setviewprop(VF_PERSPECTIVE,TRUE);
	setviewprop(VF_DRAWCROSSHAIR,FALSE);
	dynamiclight_add([-300,0,400],1000,[0.1,0.1,0.1],0,"",0);
	addentities(MASK_ENGINE);
	renderscene();
}
This is the shader. I also tried to remove the program directive but light issue remains

Code: Select all

cubemat
{
	program defaultwall
	diffusemap textures/env/red.tga
}
Soo weird that effect goes away when another window takes control! :shock: Did anyone tried on Linux to see if same issue happens on X11?
Meadow Fun!! - my first commercial game, made with FTEQW game engine
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: [FTE]v5221 dynamic light issue

Post by toneddu2000 »

I modified code a little to let you test the issue better.

Code: Select all

entity testobj;
float ltest;
float dynlight;
void CSQC_Init(float apilevel, string enginename, float engineversion)
{
	dynlight = cvar("render_light_dynamic");
	testobj = spawn();
	setorigin(testobj,[0,0,128]);
	precache_model("models/cube.iqm");
	setmodel(testobj,"models/cube.iqm");
	testobj.drawmask = MASK_ENGINE;
	if(!dynlight){
		ltest = dynamiclight_spawnstatic([-300,0,400],1000,[0.1,0.1,0.1]);
	}
}
//
void CSQC_WorldLoaded(){}
noref float CSQC_ConsoleCommand(string cmd){return TRUE;}
float CSQC_InputEvent(float evtype, float scanx, float chary, float devid){return 0;}
void CSQC_Input_Frame(){}
//
void CSQC_UpdateView(float w, float h, float notmenu)
{
	clearscene();
	setviewprop(VF_ORIGIN,[-400,0,400]);
	setviewprop(VF_ANGLES,[45,0,0]);
	setviewprop(VF_PERSPECTIVE,TRUE);
	setviewprop(VF_DRAWCROSSHAIR,FALSE);
	if(dynlight){
		ltest = dynamiclight_add([-300,0,400],1000,[0.1,0.1,0.1],0,"",0);
	}
	addentities(MASK_ENGINE);
	renderscene();
	drawstring([10,10,0],strcat("dynlight: ",ftos(dynlight)),[10,10,0],[1,1,1],0.4,0);
}
Just set in default.cfg

Code: Select all

set render_light_dynamic 1
And then launch map, if cvar render_light_dynamic is set to 0, static light will be rendered and no flickering/overbright will occur, instead, setting that cvar to 1, only dynamic light will be rendered and it will flicker and do the overbright stuff
Meadow Fun!! - my first commercial game, made with FTEQW game engine
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: [FTE]v5221 dynamic light issue

Post by toneddu2000 »

thanks Spike, v5230 seems to have fixed the issue.
Really appreciated
Meadow Fun!! - my first commercial game, made with FTEQW game engine
Post Reply