Gandi Posted April 19, 2012 Share Posted April 19, 2012 Hi, Is it possible to add custom variables to the water.frag shader from framewerk? I want to add some additional variables for use in my shader (i edited the water.frag shader) and want to be able to add them in the editor (via lua...) also i want to change the textures used for the water shader. is this possible for fw, or do i have to add my own implementation for the waterplane? Quote Link to comment Share on other sites More sharing options...
shadmar Posted April 20, 2012 Share Posted April 20, 2012 Wondering about this myself, I think it will work using SetShaderFloat/Vec#, but I'm not sure how to use it correctly I tried SetShaderFloat from the editor but I don't know how to fetch current material (to get to the shader) in lua (if we even need to do this) Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
Guest Red Ocktober Posted April 20, 2012 Share Posted April 20, 2012 (ooops, Shad snuck in there right before i hit the post button ) anything i say about shaders is suspect, but i'm sure you can mod the textures easily enough, but for specifics on this you'll have to wait for someone who knows what they're talking about... sorry... sorry for the vague response... the question has been sitting up there for a few days with no answers, so i thought i'd at least let you know that you're not being ignored... --Mike Quote Link to comment Share on other sites More sharing options...
Gandi Posted April 20, 2012 Author Share Posted April 20, 2012 for SetShaderXXXX i need to get at least the mesh of the waterplane to get its material->shader, but i dont think there is a direct way of getting the mesh from FW For changing the textures i dont mean exchanging the bumpmap image or so, but exchanging the refraction/reflection normal buffers by a texture i created for instance. ( dont know why they even use the normal buffers in the water shader..). My problem is, that i got no documentation of the lua-commands (for fw especially). Quote Link to comment Share on other sites More sharing options...
Guest Red Ocktober Posted April 20, 2012 Share Posted April 20, 2012 i need to get at least the mesh of the waterplane to get its material->shader i dunno if this is gonna help any, but here's a line of code (BlitzMax + LW 2.43) i used to retrieve the waterpatch (TMesh)... HideEntity Game.fw.renderer.waterpatch waterMesh = fw.renderer.waterpatch should do it... fetch current material (to get to the shader) in lua (if we even need to do this) gonna play around a bit with lua later... but with what lil i know about shaders, i also wonder if doing this is necessary... here's a lil bit of lua from the script editor that accesses the waterpatch --require("Scripts/Constants/engine_const.lua") Graphics(800,600) RegisterAbstractPath("") TFilter(1) AFilter(16) fw=CreateFramework() camera=fw.main.camera scene=LoadScene("abstract::myNew3.sbx") camera:Movef(0,9,-5) camera:SetZoom(2.2) daynight=scene:FindChild("daynight_2"); daynight:SetKey("rate",114) while(KeyHit(KEY_ESCAPE)==0 and AppTerminate()==0) do if KeyDown(KEY_A)==1 then camera:Turn(Vec3(0,2,0)) end if KeyDown(KEY_D)==1 then camera:Turn(Vec3(0,-2,0)) end if KeyDown(KEY_H)==1 then HideEntity(fw.renderer.waterpatch) end fw:Update() fw:Render() SetBlend(1) DrawText("Hello There",20,20) SetBlend(0) Flip() end the c++ reference to the framewerk are here... http://www.leadwerks...title=Framewerk the code for water is in the renderer... look in C:Program FilesLeadwerks Engine SDK250BMXFramework for renderer.bmx and open it up in a text editor... a search for waterpatch will bring you right to where water is implemented... it's a pretty straight forward read and easy to follow logic... these two things should help you find enough info to do what you want in lua as most of it is easily translatable to lua script... good luck... -Mike Quote Link to comment Share on other sites More sharing options...
macklebee Posted April 20, 2012 Share Posted April 20, 2012 yes you can access the waterpatch... just as long as fw:Render() occurs at least once before you try to access it. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel 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.