tkunze Posted June 22, 2010 Share Posted June 22, 2010 in my old game engine i used the attached simple HLSL shader to attach an water effect to an entity. Unfortunatelly i have no clue about GLSL so far as in the engine i used before everything was HLSL. Is there anyone who can (and is willed to) port this shader to GLSL? I think it is usefull because it is a possibility to crate a water model which can be used to place water above the leadwerks waterplane to build e.g. lakes. The shader is pretty simple and uses a cubemap for the reflection and a bumpmap but it still looks ok for me. Sample look of simple water shader (the image is 5 years old): watershader.zip Quote Link to comment Share on other sites More sharing options...
Guest Red Ocktober Posted June 22, 2010 Share Posted June 22, 2010 TK... if your goal is to be able to create lakes and other bodies of water at different elevations, you really don't need to change the shader... open Render.cpp or .bmx and search for waterpatch... the second occurance will be where the waterpatch is created... simply substitute the waterpatch for an acceptable mesh and either build it or load it as a replacemenent... you can make several of these, and place em where ever you want to make lakes and such... you will have to take into consideration are the waterheight, which will determine the at what point underwater effects are activated, but those should be easy enough to control... i think (haven't actually done it during runtime, only at the start) you just need to change the waterheight ( fw.Renderer.SetWaterHeight(17) should do it ) to conform with the local aread of the lake the player is near... hope this was helpfull... good luck... --Mike Quote Link to comment Share on other sites More sharing options...
tkunze Posted June 22, 2010 Author Share Posted June 22, 2010 This is exactly my goal. The way you describe looks interesting - but does this mean i have to use framewerk? Or is it possible to run this together with framework? Quote Link to comment Share on other sites More sharing options...
Guest Red Ocktober Posted June 22, 2010 Share Posted June 22, 2010 The way you describe looks interesting - but does this mean i have to use framewerk? Oris it possible to run this together with framework? OOooops!!! yup... forgot all about my reliance on the old framewerk me thinks this approach should be fine with the new stuff... this is exactly what i did to add the waves 2.31... gimme a second or two... --Mike Quote Link to comment Share on other sites More sharing options...
Rick Posted June 22, 2010 Share Posted June 22, 2010 I worked on water patches some but never go to much into it. I just made a plane that you could size in the editor. My idea for the underwater effect was more to use a body in the shape of a cube and when the camera is inside the AABB of the body it would trigger the underwater effect. Quote Link to comment Share on other sites More sharing options...
Guest Red Ocktober Posted June 22, 2010 Share Posted June 22, 2010 @ TK... here's a snippet of BMAX code from Mack's simple scene loader... the Framework is used to create a global object (fw) after the lua glue functions were generated... SuperStrict Framework leadwerks.ENGINE Import "Framework\Framework.bmx" Import lugi.generator 'To generatue glue functions for Lua, comment this line out: Include "lua-gluefunctions.bmx" 'And uncomment these two lines, run the program once, Then undo your changes: 'generateGlueCode("lua-gluefunctions.bmx") 'End ... ... 'Create a New Framework Object. Global fw:TFramework = TFramework.Create() If Not fw RuntimeError "Failed To initialize engine." SetScriptObject("fw", fw) 'Setup the Global script objects. SetPostFX() 'Setup the post processing FX SetVegetationShadowMode(0) 'Setup vegetation layer shadows : 0 = off : 1 = on. and the fw properties can now be accessed like this... Global scene:TEntity = LoadScene("Abstract::test5.sbx") fw.renderer.ReflectionRenderComponents=ENTITY_RENDERABLE fw.renderer.SetWaterAmplitude(16.6) fw.renderer.SetWaterHeight(3.8) so all should work well... you can set the waterheight and other properties on the fly... @Rick... easier to use what is already given... when the character is near Lake Meade, why not simply set the waterheight to what the waterheight is at Lake Meade... when the character is near lake Tahoe... set it to that elevation... why complicate things unnecessarily... or make it so that everytime a new version comes out you have additional work to do... KISS baby... guaranteed to work every time... --Mike Quote Link to comment Share on other sites More sharing options...
Masterxilo Posted June 25, 2010 Share Posted June 25, 2010 The physics/newton & LE water plane implementation only allows for one infinite waterplane... Quote Hurricane-Eye Entertainment - Site, blog. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.