havenphillip Posted November 4, 2020 Share Posted November 4, 2020 I'm finally beginning to understand the depth projection in the Leadwerks water. I have a script set up to set the depth to a buffer (otherwise you have to turn on water mode, which I don't want to do) and it's almost working but it's shifting like crazy. When I walk around its fine but as soon as I move the camera it goes nuts. This doesn't happen with the LE water so what is different about the water mode that keeps that from happening? Is there a lua code behind the LE water somewhere or what? How do I get it to stop? Here's my code which I reduced down from an old Shadmar water function Script:Start() self.context=Context:GetCurrent() buffer2 = Buffer:Create(self.context:GetWidth(),self.context:GetHeight(),1,1,0) buffer = Buffer:GetCurrent() surface = self.entity:GetFace(0) --for brushes water = surface:GetMaterial() depth = buffer2:GetDepthTexture() water:SetTexture(depth,4) end function Script:UpdateWorld() buffer2:Enable(); self.entity:Hide(); world:Render() buffer:Enable() self.entity:Show(); end . Quote Link to comment Share on other sites More sharing options...
havenphillip Posted November 7, 2020 Author Share Posted November 7, 2020 Well I deleted the player out of the scene and put him back in and it works fine now. Looks like the water plane has to be set up before the player is placed in the scene. Something to do with the camera order of operations or something I guess. Quote 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.