about water. >>>>

Started by
7 comments, last by 88er 20 years, 10 months ago
which way is usualy use to create water. 1.use transparence material + texture. 2.use texture with alpha channel. i think the first one is faster. i didn''t konw the diffent between using material or using texture.
Advertisement
Yann L hosted a lecture on the #Lecture channel on AfterNET about Realistic Water Rendering a while back. It''s a good read. Here is the log.


Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
You can create water by use texture with alpha channel.
This is a easy way and can make high FPS

Show the effect screenshot:



-ÎÒ˼¹ÊÎÒÔÚ£¬ÄÔ´ü²»»á»µ-

[edited by - F_O_X on June 5, 2003 1:20:24 AM]

[edited by - F_O_X on June 5, 2003 1:20:55 AM]
-ÎÒ˼¹ÊÎÒÔÚ£¬ÄÔ´ü²»»á»µ-
thx,but why not use material,
I didn''t know when shoule i use material,
Use material will get low performance??
Because use texture with alpha channel only define four vectex.
use transparence material + texture must need define N vectex.
-ÎÒ˼¹ÊÎÒÔÚ£¬ÄÔ´ü²»»á»µ-
Like that water texture in the screenshot... is it animated?
how did you create it?
YES,it is animated.

void CLake::LoadTex(){	D3DXCreateTextureFromFile(m_pD3DDevice,"water/water.bmp",&m_pWaterTex);	char path[255];	for( int i=0;i<32;i++ ){		sprintf(path,"%s%d%s","water1/caust",i,".tga");		D3DXCreateTextureFromFile(m_pD3DDevice,path,&m_pTexture[i]);	}}void CLake::Render(){	m_pD3DDevice->SetRenderState(D3DRS_TEXTUREFACTOR,D3DCOLOR_ARGB(180,80,80,252));	m_pD3DDevice->SetStreamSource(0, m_pVertexBuffer, sizeof(TREE_CUSTOMVERTEX));	m_pD3DDevice->SetVertexShader(D3DFVF_CUSTOMVERTEX);		m_pD3DDevice->SetTexture(0, m_pTexture[m_pCurrentN]);	m_pD3DDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );	m_pD3DDevice->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA);	m_pD3DDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);	m_pD3DDevice->SetTextureStageState(0, D3DTSS_COLOROP,  D3DTOP_ADDSIGNED);	m_pD3DDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);	m_pD3DDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_TFACTOR);	m_pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TFACTOR );	m_pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP,   D3DTOP_SELECTARG1 );	m_pD3DDevice->SetTextureStageState( 0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR );	m_pD3DDevice->SetTexture(1, m_pTexture[31-m_pCurrentN]);	m_pD3DDevice->SetTextureStageState( 1, D3DTSS_COLORARG1, D3DTA_TEXTURE );	m_pD3DDevice->SetTextureStageState( 1, D3DTSS_COLOROP,  D3DTOP_ADDSIGNED );	m_pD3DDevice->SetTextureStageState( 1, D3DTSS_MAGFILTER, D3DTEXF_LINEAR );	m_pD3DDevice->SetTextureStageState( 1, D3DTSS_ALPHAARG1, D3DTA_TFACTOR );	m_pD3DDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP,   D3DTOP_SELECTARG1 );	m_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);	m_pD3DDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );	m_pCurrentN++;	if(m_pCurrentN>31){		m_pCurrentN=0;	}	m_pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP,   D3DTOP_SELECTARG1 );	m_pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );}


DEMO ONE URL:http://www.gamelab.ns.tc/a.rar This Demo not use ALPHAOP

DEMO TWO URL:http://www.gamelab.ns.tc/b.rar This Demo use ALPHAOP

GOOD LUCK

-ÎÒ˼¹ÊÎÒÔÚ£¬ÄÔ´ü²»»á»µ-
-ÎÒ˼¹ÊÎÒÔÚ£¬ÄÔ´ü²»»á»µ-
Can''t get the links to work...
would really like to see the water in action...
i have done an animated water in my game, just 5 frames and setTexture when changing but its not that exciting looking
You can download it late,the web server might idle now.

Could you upload the screenshot of your water-effect? THX
-ÎÒ˼¹ÊÎÒÔÚ£¬ÄÔ´ü²»»á»µ-

This topic is closed to new replies.

Advertisement