Jump to content
  • Advertisement
Sign in to follow this  
Basiror

OpenGL rendering 4 layered terrain as fast as possible

This topic is 5150 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi here s the class that holds terrain batches in my engine
[SOURCE]
class CTerrain
{
public:
	CTerrain()
	{
		m_pNext = NULL;
	};
	int			m_iWidth;
	int			m_iHeight;
	int			m_iCapWidth;
	int			m_iCapHeight;
	Vector		m_vecMin;
	Vector		m_vecMax;
	BOOL		m_bLayer1;
	BOOL		m_bLayer2;
	BOOL		m_bLayer3;
	char		*m_pszTexture0;
	char		*m_pszTexture1;
	char		*m_pszTexture2;
	char		*m_pszTexture3;
	CShader		*m_pShader0;
	CShader		*m_pShader1;
	CShader		*m_pShader2;
	CShader		*m_pShader3;
	float		*m_pVertexArray;
	float		*m_pUVArray;
	float		*m_pNormalArray;
	float		*m_pBlendFactor;
	int			*m_pIndex;
	CTerrain	*m_pNext;
};
[/SOURCE]
-the psztexture pointers hold the name of the texture that is use for the correspondent layer -blendfactor holds RGB values for blending layer 1 2 3 onto the baselayer 0 -m_pShader* are pointers to structures that hold the properties defined in .shader files now to the CShader thing it contains material properties used for opengl lighting like mat_ambient ... you specify dot3 bumpmaps parallax mapping there you can give each texture a detailmap and specify the blendmode so if i use dot3 bumpmapping parallax mapping and a detailmap for each layer i get up to 16 texture units, the maximum on a geforce 6800 now my batches are devided into 512*512 units e.g. the player is 72 units large and i want to feature up to 8 lights now i don t know how i should render all this the most efficient way i will need multiple passes thats clear + the shadowmaps for the directional, spot and omnidirectional pointlights should i render each layer in a separate pass? or write a dynamic pixel and vertex shader (shader branching is supported on gf6800 cards) ?

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!