Jump to content

shadmar

Members
  • Posts

    3,618
  • Joined

  • Last visited

Posts posted by shadmar

  1. Not in the current version, maybe in a later version, its just an wavy mesh for now, no underwater or transparency. Haven't figured out how transpericy in the shaders works (refraction) I seem to get reflection or some distortion. Ah well learing from the existing shadersis hard :)

  2. One more thing, the mesh has skirts, but the skirt normals points straight up to minimize tiling visibility.

     

    And... forgot to change the deafults

    For best look with deafult skybox, set cubemap blend to 0.35 and bump to 0.3 and normal to 0.5 - fixed and reuploaded.

     

    Should look like this then:

     

    LE_ocean10.jpg

  3. Hmm... well xz and y displacement with 12 aggregated waves, makes not perfectly tilable.

    If you still want it I can upload it in it's current state. I tried with some skirts but you can still notice.

    But I guess an adaptive mesh would maybe solve this, but that's beyond my programming skills.

    Max mesh size are 32k triangles, I get all sorts of distortion if I go any higher.

  4. Yeah I'm not pursuing perfect foam, but another problem, not actually perfect tile match...

     

    LE_ocean8.jpg

     

    But anyway.. Just the lua controls to go and I can upload it as an alpha test ocean to get some feedback...

     

    Mikes sub luring about in the sunset :

     

    LE_ocean7.jpg

    • Upvote 1
  5. Thanks.

     

    I think it's more on the side than below, you give the GPU some data and then you can control them in shader language.

    But I think it's a one way ticket, once your data is sendt to the GPU, there is no coming back to CPU to perform physics, but I'm no expert.

     

    Anyway trying some foam on the waves based on vertex y, not entirly happy, seem abit un-natural in movement.

     

    LE_ocean6.jpg

  6. @roland.. lol I hope you find your socks :)

     

    @Gandi thx for the feedback, I haven't tried tiling it yet, but I guess you could cull the tiles. 32k osn't that much so I guess you could deploy a larger mesh.

     

    @Mike I thought my ocean looked great with your sub in it :)

  7. This is my current cluttered script for the ocean object, but I see no trace of wavescale, wfreq or wlength in my sbx, so the ocean is always default between loads. (im a totally newbie on this so any help is appreciated smile.png )

     

    How can I persist my settings in the sbx ? Say if I cange wfreq in the dialog

     

    require("scripts/class")
    require("scripts/math/math")
    local class=CreateClass(...)
    function class:InitDialog(grid)
    self.super:InitDialog(grid)
    group=grid:AddGroup("Ocean")
    group:AddProperty("wavescale",PROPERTY_FLOAT,"0,20,2","Wave Scale")
    group:AddProperty("wlength",PROPERTY_FLOAT,"0,2,2","Wave Length")
    group:AddProperty("wspeed",PROPERTY_FLOAT,"0,1,2","Wave Speed")
    group:AddProperty("wfreq",PROPERTY_FLOAT,"0,10,2","Wave Frequency")
    group:AddProperty("bumpscale",PROPERTY_FLOAT,"0,10,2","Surface Bump")
    --group:AddProperty("camerarange",PROPERTY_VEC2,"","Camera range")
    --group:AddProperty("backgroundmode",PROPERTY_CHOICE,"None,Solid,Skybox","Background")
    --group:AddProperty("backgroundcolor",PROPERTY_COLOR,"","Background color")
    --group:AddProperty("skymaterial",PROPERTY_FILE,"Material Files (*.mat):mat","Skybox")
    --group:AddProperty("fogmode",PROPERTY_BOOL,"","Distance fog")
    --group:AddProperty("fogcolor",PROPERTY_COLOR,"1","Fog color")
    --group:AddProperty("fogrange",PROPERTY_VEC2,"","Fog range")
    --group:AddProperty("fogangle",PROPERTY_VEC2,"","Fog angle")
    --group:AddProperty("gravityforce",PROPERTY_VEC3,"","Gravity")
    --group:AddProperty("Saturation",PROPERTY_FLOAT,"0,2,1")
    --group:AddProperty("Brightness",PROPERTY_FLOAT,"0,2,1")
    --group:AddProperty("Contrast",PROPERTY_FLOAT,"0,2,1")
    --group:AddProperty("cullrange",PROPERTY_VEC3,"","Cull range")
    --group:Expand(1)
    end
    function class:CreateObject(model)
    local object=self.super:CreateObject(model)
    object.model = model
    object.wavescale =1
    object.wlength = 0.75
    object.wspeed = 0.025
    object.wfreq= 1
    object.bumpscale = 1
    
    function object:SetKey(key,value)
     if key=="wavescale" then
      self.wavescale = tonumber(value)
    elseif key=="wlength" then
      self.wlength = tonumber(value)
    elseif key=="wspeed" then
      self.wspeed = tonumber(value)
    elseif key=="wfreq" then
      self.wfreq = tonumber(value)
    elseif key=="bumpscale" then
      self.bumpscale = tonumber(value)
     end
    end
    function object:GetKey(key,value)
     if key=='wavescale' then
      return tonumber(self.wavescale)
    	   elseif key=="wlength" then
      return tonumber(self.wlength)
    	   elseif key=="wspeed" then
      --Notify(tonumber(self.wspeed))
      return tonumber(self.wspeed)
    	   elseif key=="wfreq" then
      return tonumber(self.wfreq)
    	   elseif key=="bumpscale" then
      --Notify(tonumber(self.bumpscale))
      return tonumber(self.bumpscale)
     end
    end
    function object:UnlockKeys(model)
     self:Refresh()
    end
    
    function object:Init()
     --self:Refresh()
    end
    function object:Refresh()
     if fw~=nil then
     local mat=LoadMaterial("abstract::rock1.mat")
     local shader=GetMaterialShader(mat)
     SetShaderFloat(shader,"wscale",self.wavescale)
     SetShaderFloat(shader,"wlength",self.wlength)
     SetShaderFloat(shader,"wspeed",self.wspeed)
     SetShaderFloat(shader,"wfreq",self.wfreq)
     SetShaderFloat(shader,"bumpscale",0.1)
     object:SetKey( "wavescale", self.wavescale )
     end
    end
    
    function object:needsUpdate()
     self:Refresh()
    end
    
    function object:Reset()
     self:Refresh()
    end
    
    function object:Free(model)
     self.super:Free()
    end
    
    object:Init()
    
    end
    

  8. At Night with Mike Type23 luring in a pack smile.png

     

    I'll share it in the asset store (free), but I want to try to get some foam and shore foam, and maybe som refraction in first + about 30 tunable parameters in the lua dialog.

     

    LE_ocean5.jpg

  9. Thanks, and I doubt objects will interact with waves unless SetBodyBuoyancyMode can read values from the GPU, there is no CPU work here, the CPU considers the ocean as a flat 128x128 vertex plane. Everything is done in GPU... So buoyancy needs to be scripted/programmed I think.

     

    Silent before the storm!!

     

    LE_ocean4.jpg

    • Upvote 1
  10. You mean the existng one? You have to add a texture slot in the mat file and then blend it in the shader using GLSL. But I haven't tried a diffuse one, just an extra normalmap like this :

     

    normal += texture2D(texture7,modelvertex.xz*scale).xyz * 2.0 - 1.0; 

     

    (on both refraction and reflection normals)

  11. How to do this in the editor, I only get a crash when calling GetMaterialShader ?

     

    function object:Init()
           object:SetKey("material", "rock1.mat")
           material=self:GetKey("material", "rock1.mat")
      	 shader=GetMaterialShader(material)   --    =====> Crashes EXCESS VIOLATION
      	 SetShaderFloat(shader,"wavescale",2)
    end

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

×
×
  • Create New...