Hey!

Sorry for off-topic, but I wanted to ask for a little advice. How would you pass light calculations from VS to PS ?

Currently, I do all light calculations in VS, then in PS I read pixel color from texture and "add" it to the color which already has calculated lights. This isn't probably the best way to handle this situation, because I get 'illumination lag' when I rotate light source (let's say counterclockwise) and object receiving light (clockwise). This only happens in shader version 3.0 and with light calculations, you provided in this thread.

This is what I currently do:
Code
VS {
	....
	outcolor = (vecAmbient * vecLight) .... blahblah
	for(i=0; i<8; i++)
	{
		outcolor.rgb += calculated light
	}
	...
}

PS {
	...
	float4 textureColor = tex2d
	Incolor.rgb *= textureColor;
	...
}

You can see how 'lag' looks like here:
Youtube link

Best regards!


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung