Jump to content

Framewerk Water custom parameter


Gandi
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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)

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Link to comment
Share on other sites

Guest Red Ocktober

(ooops, Shad snuck in there right before i hit the post button smile.png )

 

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

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

Guest Red Ocktober
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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...