Jump to content

Depth shifting


havenphillip
 Share

Recommended Posts

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

.


 

depthshift.jpg

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