|
||||||||||||||||||
Add Forum to Favorites | Send Topic To a Friend | View Forum FAQ | Track this topic Page: 1 2 »» |
Last Thread Next Thread ![]() |
| Realistic Natural Effect Rendering: Water I |
|
![]() microcyb Banned Member since: 3/30/2004 From: USA |
||||
|
||||
| Adding in more code examples like this: void CMyFrameWnd::WaterRipple(void) { double d2Pi = 2 * (22 / 7); // 2Pi Radians = 360 Degree double dAmplitude; double dRadians; double dFrequency; double h = m_bmp.bmHeight; double y; int x; int w = m_bmp.bmWidth; int nDisp; int nFrame; int h2; m_nGap = 0; h2 = (m_ptOverlay.y >= m_bmp.bmHeight) ? 0 : (m_bmp.bmHeight - m_ptOverlay.y); Also maybe some cool downloads for people to learn from. for (nFrame = 0; nFrame <= MAX_FRAME; nFrame++) { x = nFrame * w; dRadians = (d2Pi * nFrame) / MAX_FRAME; for (y = 0; y < h; y++) { dAmplitude = (h / 18) * (y + 28) / h; dFrequency = (h / 7) * (h - y) / (y + 1); nDisp = (int)(sin(dRadians + dFrequency) * dAmplitude); if (y + nDisp < 0) { nDisp = (int)(y * -1); } m_dcRipple.StretchBlt(x, (int)y, w, 1, &m_dcReflection, 0, (int)y + nDisp, w, 1, SRCCOPY); } if (nDisp > m_nGap) { m_nGap = nDisp + 2; } // Draw Overlay (bottom part) on Ripple image if (m_ptOverlay.y + m_bmpOverlay.bmHeight > m_bmp.bmHeight) { m_dcRipple.StretchBlt(x + m_ptOverlay.x, 0, m_bmpOverlay.bmWidth, m_bmpOverlay.bmHeight - (m_bmp.bmHeight - m_ptOverlay.y), &m_dcTrueMask, 0, h2, m_bmpOverlay.bmWidth, m_bmpOverlay.bmHeight - (h2), SRCAND); m_dcRipple.StretchBlt(x + m_ptOverlay.x, 0, m_bmpOverlay.bmWidth, m_bmpOverlay.bmHeight - (m_bmp.bmHeight - m_ptOverlay.y), &m_dcOverlay, 0, h2, m_bmpOverlay.bmWidth, m_bmpOverlay.bmHeight - (h2), SRCINVERT); } } } |
||||
|
||||
![]() Promit Moderator - Graphics Programming and Theory Member since: 7/29/2001 From: Baltimore, MD, United States |
||||
|
|
||||
| Wow. Just wow. Ultra-awesome-ness. It's really unfortunate I don't have a system that supports PS 1.3 ![]() |
||||
|
||||
![]() evolutional Moderator - Alternative Game Libraries Member since: 1/25/2002 From: Leeds, United Kingdom |
||||
|
|
||||
| It's nice to see articles of this Calibre. Thanks Yann :) |
||||
|
||||
![]() _DarkWIng_ Member since: 1/11/2001 From: Duplje, Slovenia |
||||
|
|
||||
| Looks good so far... You should never let your fears become the boundaries of your dreams. |
||||
|
||||
![]() microcyb Banned Member since: 3/30/2004 From: USA |
||||
|
||||
| It would be cool to have a code sample like this on the page. http://www3.tky.3web.ne.jp/~tkano/archives/tlwater104.zip Very cool indeed though, and keep it up! |
||||
|
||||
![]() sBibi Member since: 3/18/2003 From: France |
||||
|
|
||||
| nice... looking forward to the rivers/waterfalls part |
||||
|
||||
![]() James Trotter Member since: 1/12/2003 From: Oslo, Norway |
||||
|
|
||||
| Great! Well written and informative. I particularly like that several different options for implementation are discussed, with both pros and cons. Keep up the good work! |
||||
|
||||
![]() pan narrans Staff Member since: 6/4/2002 From: Leeds, United Kingdom |
||||
|
|
||||
I'm so happy I could dance. So I will:![]() Thanks Yann Minister of Propaganda : leighstringer.com : Nobody likes the man who brings bad news - Sophocles (496 BC - 406 BC), Antigone |
||||
|
||||
![]() Ilici Member since: 3/23/2003 From: Bucuresti, Romania |
||||
|
|
||||
| I was expecting a copious section of resulting pictures of the method you used Yann.. I guess i'd have to implement it myself to get them. Anyway, great job! |
||||
|
||||
![]() Emmanuel Deloget GDNet News Lead Member since: 8/27/2003 From: France |
||||
|
|
||||
Quote: Even if you don't have one, you may still be able to play with shaders by using swShader by Nicolas Capens. It may require a bit of work to redo the shaders using the shader assembler language. (returning to the topic) Great article. The tone is good, explications are deep and interesting. It looks like everything is easy to do. I'm really impressed by Yann's article writer qualities. "Better than good" job, and thanks a lot Mr. Lombard ! [broken link, as spotted by evolutional] [Edited by - Emmanuel Deloget on September 8, 2004 7:42:36 AM] -- Emmanuel D. [blog, in French] [blog, very bad googlized translation] [NEW: English version of teh blog! (WIP)] |
||||
|
||||
![]() python_regious Member since: 2/28/2001 From: Bath, United Kingdom |
||||
|
|
||||
God, I can't wait to get my shader system up and running now. *opens VS*... ![]() If at first you don't succeed, redefine success. |
||||
|
||||
![]() etothex Member since: 5/2/2004 From: Los Angeles, CA, United States |
||||
|
|
||||
| w00t! I just got my geforce fx card 5 days ago and I've been cg programming when I should've been doing homework...now there's at least one good water tutorial out there. I've been meaning to find some cg tutorials online, this is awesome. I'm trying to find more about fragment programs, but it seems I can't find too much info...even a reference guide would be good. Maybe I'll suck down and buy The Cg Tutorial book. Now if Yann wrote a book...that I would buy. Even if it was just a collection of articles he wrote on the internet. :) |
||||
|
||||
![]() __Daedalus__ Member since: 12/12/2002 From: Edinburgh, United Kingdom |
||||
|
|
||||
Perfect timing - thanks ![]() |
||||
|
||||
![]() d000hg Member since: 1/21/2002 From: Durham, United Kingdom |
||||
|
|
||||
| A question to someone - that cubemap that can be used forreflections - where is it's origin? The centre of the body of water or the camera position? Only when you do this for a shiny car I thought you put the camera inside the car and rendered images looking outwards to get the cubemap? |
||||
|
||||
![]() jinx_ Member since: 9/3/2004 From: United Kingdom |
||||
|
|
||||
| Absolutely fantastic. Thanks Yann. Jinx |
||||
|
||||
![]() s_p_oneil Member since: 11/26/2003 From: Atlanta, GA, United States |
||||
|
|
||||
| Looks good, Yann. I've concentrated on the ground and sky so much that I haven't gotten to the water, so I'm looking forward to the next article. P.S. - You still haven't sent me a response regarding the scattering article. ;-) |
||||
|
||||
![]() _DarkWIng_ Member since: 1/11/2001 From: Duplje, Slovenia |
||||
|
|
||||
Quote: It doesn't matter where you put it's origin in this case, becouse cubemap only represents objects at (near) infinite distance. This is basicly modified skycube. But if you use cubemap for reflection on small objects, then yes, put origin in it's center. microcyb: d2Pi = 2 * (22 / 7); ... nice approximation for Pi .You should never let your fears become the boundaries of your dreams. |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| impatience... what is going to be the period between two articles :) i reaally want to read many more like this one! :) |
||||
|
||||
![]() paulc Member since: 11/16/2002 From: United Kingdom |
||||
|
|
||||
| Very well written, especially the bit on projective texturing. Only had to read it once and now fully understand projective texturing and how/why it works. While I've used the technique before, I have never had an intrinsic understanding of the maths. Now its all clear. Thankyou very much. |
||||
|
||||
![]() Myopic Rhino Staff Member since: The dawn of time
From: Temecula, CA, United States |
||||
|
|
||||
Quote:It's up to Yann. I'll post them soon after receiving them. |
||||
|
||||
![]() scratch Member since: 3/30/2004 |
||||
|
|
||||
| I don't really understand how the reflection matrix Mf works. First of all, if the water surface is parallel to the XY plane, doesn't that mean that the reflected ray, from a ray (x, y, z) hitting the plane is (-x, -y, z) instead of (x, y, -z) as the article says? Secondly, I don't understand how transforming vertices of your objects using this reflection matrix and rendering them actually builds the reflection map. I'd love some more explanation, or a reference to another paper/article that explains this would be nice (maybe with some illustrations). All an all, a nice article, but schematic illustrations could make it clearer. --nico |
||||
|
||||
![]() s_p_oneil Member since: 11/26/2003 From: Atlanta, GA, United States |
||||
|
|
||||
Quote: When a ray going downward is reflected, does it keep going downward? It would have to if you reflected it from (x, y, z) to (-x, -y, z). The article is correct, only the z component is reflected. |
||||
|
||||
![]() Taharez GDNet+ Member since: 6/18/2000 From: Stockholm, Sweden |
||||
|
|
||||
| Very, very cool, thanks for the article Yann! Looking forward to the next one :) |
||||
|
||||
![]() Hightree Member since: 1/18/2002 From: Netherlands |
||||
|
|
||||
| Thanks very, very much :D Another holy grail within grasp. Reality, is that where the pizza delivery guy comes from ? |
||||
|
||||
|
Page: 1 2 »» All times are ET (US) ![]() |
Last Thread Next Thread ![]() |
|