Jump to content

shadmar

Members
  • Posts

    3,618
  • Joined

  • Last visited

Posts posted by shadmar

  1. Ok, I see the problem, that is not easy to fix since sprites and particles always renders without depth, so the fog shaders doesn't even consider the sprites/paticles at all (they are invisible for the shader and the fog shader, they keep the depth of the geometry behind them)

     

    Unfortunately there is no way for me to calculate their depth either.

  2. Hey, you can try adding this as line 63 in _klepto_fog.shader and set fogislocal to 0

     	 if (fragData0.a < 1.0) fogeffect*=clamp(fragData0.a,0.0,1.0);

     

    or keep fogislocal as 1 and add this as line 63:

     

     	 if (fogislocal) fogeffect=0;

  3. I would probably do it something like this (but it always renders black)

     

    function Script:Start()
    
       --get workd,context etc..
       self.context=Context:GetCurrent()
       self.world=World:GetCurrent()
       self.resolution=1024
    
       --fetch a camara
       if self.camera==nil then
           for i=0,self.world:CountEntities()-1 do  --CountEntities is not a supported command
    		    if self.world:GetEntity(i):GetClass()==Object.CameraClass then
    			  self.camera=self.world:GetEntity(i)  --GetEntity is not a supported command
    			  tolua.cast(self.camera,"Camera")
    			  System:Print(self.world:GetEntity(i):GetClassName())
    			  break
    			 end
           end
       end
    
       --cube directions
       self.cameraRotations = {
           Vec3(0,0,0),
           Vec3(0,180,0),
           Vec3(-90,-90,0),
           Vec3(90,-90,0),
           Vec3(0,-90,0),
           Vec3(0,90,0)
       }
    
       --make cam buffer
       self.cameraBuffer = Buffer:Create(self.resolution, self.resolution, 1, 0)
       self.cameraBuffer:GetColorTexture():SetFilter(Texture.Pixel)
    
       --make cube buffer using cubemap texture
       self.cubebuffer =  Buffer:Create(self.resolution, self.resolution, 1, 0)
       self.cubemap = Texture:CubeMap(self.resolution, self.resolution)
       self.cubebuffer:SetColorTexture(self.cubemap)
    
    
    
       --ok warap the cubemap around something
       model=Model:Box(10,100,10)
       material=Material:Create()
       shader=Shader:Load("Shaders/Editor/SkyBox2.shader")
    
    
       material:SetShader(shader)
       model:SetMaterial(material)
    end
    
    
    
    function Script:UpdateWorld()
       -- render workd into a buffer and then copy buffer texture to a cubemap buffer
       for i = 1,6 do
           self.camera:SetRotation(self.cameraRotations[i])
           self.cameraBuffer:Enable()
           self.world:Render()
           self.cameraBuffer:Disable()
           self.cubebuffer:SetColorTexture(self.cameraBuffer:GetColorTexture(), 0, i-1) --write cambuffer to cubebuffer each face
       end
       Context:SetCurrent(self.context)
    
       material:SetTexture(self.cubebuffer:GetColorTexture())
       shader:Enable() -- enable skybox shader2
       self.cubebuffer:GetColorTexture():Bind(0) --assign cubemap texture from buffer into texture0
    end

  4. Yeah that would be useful.

    Not very slick, but I usually just delete the model and look at the editor log window if I can't figure out the model used. Then ctrl+z to bring it back again.

×
×
  • Create New...