Jump to content
Sledge

Skybox rendering

Recommended Posts

In a similar way to how you can render a screenshot, it would be handy if Leadwerks could render out a skybox. It would mean you'd be able to set up skybox scenes within the editor and use them to generate skybox assets without having to look to an external source.

Share this post


Link to post

That would be really handy for pre-rendering environment maps. I used to use Gile for that back in the days.

Share this post


Link to post

In LE2, I had made a scripted object for personal use that also used the old 'nvdxt.exe' to make the cubemap and I believe shadmar posted his version of a scripted object in the old download section at one point. The new LE3 editor no longer has a realtime scripting aspect to it like the old editor, so you would probably just have to run your program to create the images but it can be done fairly easily.

 

Depending on my schedule this weekend or unless shadmar beats me to it, i will post a scripted object for use.

Share this post


Link to post

Here is a quick and dirty way :

 

1. Install ImageMagick ( I used windows portable version )

http://www.imagemagick.org/script/binary-releases.php#windows

 

2. Mod app.lua to be square :

 self.window=Window:Create(self.title,0,0,System:GetProperty("screenwidth","1024"),System:GetProperty("screenheight","1024"),windowstyle)

 

3. Disable your ingame camera

 

4. Add a pivot or something where you want to create an envmap and attach this script.

 


 

function Script:Start()

taken=0

self.camera=Camera:Create()

self.camera:SetPosition(self.entity:GetPosition())

self.camera:SetFOV(90)

end

 

 

 

function Script:UpdateWorld()

self.world=World:GetCurrent()

local context = Context:GetCurrent()

 

taken=taken+1

 

--PZ

if self.camera and taken==1 then

self.camera:SetRotation(0,0,0)

end

if self.camera and taken==3 then

context:Screenshot("./1.tga")

end

 

--NZ

if self.camera and taken==5 then

self.camera:SetRotation(0,180,0)

end

if self.camera and taken==7 then

context:Screenshot("./2.tga")

end

 

--PY

if self.camera and taken==9 then

self.camera:SetRotation(-90,-90,0)

end

if self.camera and taken==11 then

context:Screenshot("./3.tga")

end

 

--NY

if self.camera and taken==13 then

self.camera:SetRotation(90,-90,0)

end

if self.camera and taken==15 then

context:Screenshot("./4.tga")

end

 

--PX

if self.camera and taken==17 then

self.camera:SetRotation(0,-90,0)

end

if self.camera and taken==19 then

context:Screenshot("./5.tga")

end

 

--NX

if self.camera and taken==21 then

self.camera:SetRotation(0,90,0)

end

if self.camera and taken==23 then

context:Screenshot("./6.tga")

end

end

 

 

 

5. Run your app

 

6. Use imagemagick montage from commandline

montage -geometry 512 -tile 6x1 1.tga 2.tga 3.tga 4.tga 5.tga 6.tga out.tga

 

7. Resave out.tex as cubemap in LE texture editor.

 

8. voila... but there are small artifacts in the seams.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

×
×
  • Create New...