Jump to content

how i can i draw in a cubemap ?


norbert
 Share

Recommended Posts

I would like to draw a image in the skybox cubemap.

But has only a effect when i draw the image at position 0,0

all others has no effect.

 

in function App:Start()

iam create the skybox

--Create skybox
sky = Model:Create()
--just render a plane and project cubemap onto it
local surface = sky:AddSurface()
surface:AddVertex(-0.5,-0.5,0, 0,0,-1)
surface:AddVertex(0.5,-0.5,0, 0,0,-1)
surface:AddVertex(0.5,0.5,0, 0,0,-1)
surface:AddVertex(-0.5,0.5,0, 0,0,-1)
surface:AddTriangle(2,1,0)
surface:AddTriangle(0,3,2)

--position in front of camera but far out to near camera clip plane
sky:SetPosition(self.FPS_CAM:GetPosition())
sky:SetRotation(self.FPS_CAM:GetRotation())
sky:Move(0,0,self.FPS_CAM:GetRange().y-50)
sky:SetScale(self.FPS_CAM:GetRange().y*10)
sky:SetParent(self.FPS_CAM)

-- and paint it
skymat=Material:Load("Materials/Sky/myskybox1.mat")
sky:SetMaterial(skymat)



self.skytexture = skymat:GetTexture()
self.FPSbuffer = Buffer:Create(2048,1536,1,0,0)
self.FPSbuffer:SetColorTexture(self.skytexture)

 

in function App:Loop()


self.FPSbuffer:Enable()
self.FPSbuffer:Clear()
self.context:DrawImage(self.sample,0,0)
self.FPSbuffer:Disable()

 

 

there is an extra command to sign in a cubemap?

have seen there is also an extra shader.

 

Shaders \ Drawing \ drawimagecubemap.shader

 

greeting norbert

Link to comment
Share on other sites

Interesting idea. A bit like how in Kerbal Space Program has different render horizons.

 

I remember Klepto made some cubemap reflection code for Leadwerks 2.x that rendered each side of the cube. It was quite efficient as it rendered on face per frame. So it took 6 frames to complete a full update of the cubemap.

 

Take at look at his implementation, may or may not work in LE3 (will need some conversion):

http://www.leadwerks.com/werkspace/blog/16/entry-654-cubemaps-realtime-here-we-go/

6600 2.4G / GTX 460 280.26 / 4GB Windows 7

Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT

Tricubic Studios Ltd. ~ Combat Helo

Link to comment
Share on other sites

Hi, In Hammer/Source engine, this is called a 3D Skybox.

 

Here a link to the description:

https://developer.valvesoftware.com/wiki/3D_Skybox

 

This is using RTT to render from a camera a "reduced model" of a little city that is used in the skybox as background as the player move, the other camera is updated so we see the perspective. Was used in lots of Source games including L4D, HL2...

 

So if we can use RTT with LE3 we could theorically render them and use them as texture for the skybox. But this would require more render passes.

Link to comment
Share on other sites

You can use buffers already, but there is no way that I know of where you can create a cubemap texture under the cuirrent lua api where you can render 6 textures to. Unless there is some setting I don't know about :)

 

http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/texture/texturecreate-r340

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

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