Cube Mapping & UV Layouts - are there rules to follow?

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

Post Reply
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2479
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Cube Mapping & UV Layouts - are there rules to follow?

Post by Griff »

Are there any rules that we need to follow when laying out the UV islands on the map so that cube mapping will work or are they placed using the objects normals or something like that? I want to try and enviroment map a cargo pod using a cubemapped starfield texture, so the uv map will mostly be a long strip for all the sides and 2 seperate pentagons for the top and bottom surfaces
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: Cube Mapping & UV Layouts - are there rules to follo

Post by Eric Walch »

Griff wrote:
Are there any rules that we need to follow when laying out the UV islands on the map so that cube mapping will work or are they placed using the objects normals or something like that?
There is no UV mapping needed. The map is just projected on the surface from the centre outward, any existing uv map is ignored.
But your object must be close to round. I tried to use it on the asteroids as I thought they might be round enough for cube maps. On al the faces that were to far off-angle to the centre, the texture became to much smeared.
I think the only use will be planets were it is superior over the current method because it has not the artefacts near the poles.

Look at the poles of the earth in Google Earth at very close range. There things also go terrible wrong because of their mapping. (I think on their Marsian map, things were even worse)
Last edited by Eric Walch on Fri Jun 18, 2010 9:05 am, edited 1 time in total.
User avatar
ADCK
---- E L I T E ----
---- E L I T E ----
Posts: 771
Joined: Thu Dec 24, 2009 12:30 am
Location: Sydney
Contact:

Post by ADCK »

Might work for an effects map (but not for a diffuse map) but i cant see any advantage to using a cube map on a non-sphere.
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2479
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

oh, that's a bit disappointing that the object needs to be fairly spherical, i was going to try the example here (Cube Environment Mapping - scroll right down to the bottom of the page)
http://www.ozone3d.net/tutorials/glsl_t ... php#part_4

the chrome griff_krait uses the Spherical Environment Mapping example and that looks really streaky alot of the time, i was hoping the cubemapping version would fix that and i could get something like the first few seconds of this video
http://www.youtube.com/watch?v=iCYplQhT3RU
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Griff wrote:
oh, that's a bit disappointing that the object needs to be fairly spherical, i was going to try the example here (Cube Environment Mapping - scroll right down to the bottom of the page)
http://www.ozone3d.net/tutorials/glsl_t ... php#part_4
The need to be fairly round only applies when you’re mapping the texture onto the object, as does the need for u/v mapping. Environment maps are not mapped to the object geometry, so all that is irrelevant. All that matters is having reasonably relevant surface normals.
User avatar
ADCK
---- E L I T E ----
---- E L I T E ----
Posts: 771
Joined: Thu Dec 24, 2009 12:30 am
Location: Sydney
Contact:

Post by ADCK »

Griff wrote:
oh, that's a bit disappointing that the object needs to be fairly spherical, i was going to try the example here (Cube Environment Mapping - scroll right down to the bottom of the page)
http://www.ozone3d.net/tutorials/glsl_t ... php#part_4

the chrome griff_krait uses the Spherical Environment Mapping example and that looks really streaky alot of the time, i was hoping the cubemapping version would fix that and i could get something like the first few seconds of this video
http://www.youtube.com/watch?v=iCYplQhT3RU
Hmm just took a look at your Griff Krait in game, it looks like the environment map isn't even being used, i even changed the 'griff_enviromentmap1.png' texture drastically and noticed absuletly no differance in the ships reflective-ness.

In fact, it looks like its using the diffuse map as the environment map.

I'm guessing there's something wrong in the shader files.
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2479
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

edit: see Erics post below for details of the download link for an enhanced and oolite 1.74 shader fixed version of the oxp

the krait oxp is broken at the moment in oolite 1.74, it needs to have it's texture uniforms listed in the shipdata.plist, so i think the weirdness you're seeing at the moment ADCK is from that.
I had a go last night at fixing this, there's a link to it here:

but this is still a sort of incomplete test version, Eric W has some awesome script ideas planned to go into the oxp, and when he gets those in that's basically the propper version everyone should download when it comes out
the enviroment mapping is only on the 'chrome' variations, luckily it's the one that comes up on the demo screen ship parade
Last edited by Griff on Fri Jun 18, 2010 3:26 pm, edited 3 times in total.
User avatar
ADCK
---- E L I T E ----
---- E L I T E ----
Posts: 771
Joined: Thu Dec 24, 2009 12:30 am
Location: Sydney
Contact:

Post by ADCK »

ah yes, that version you linked works properly.

Now that I get a proper look at it, It think using a diff texture helps, that one you're using with big stars on it its real noticable at the edges that its gettign stretched, so I tried it with a much more subtle texture, and i barely could tell it was getting stretched, here the texture i used:
(its pretty basic just black with noise.)

Image
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Griff wrote:
Eric W has some awesome script ideas planned to go into the oxp, and when he gets those in that's basically the propper version everyone should download when it comes out.
Actually, I already merged my additions in your updated version and put it in the "1.74 folder" in my signature. Because of the use of some new 1.74 scripting features it will be needing 1.74.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Post by Cody »

Hi Eric... I tried the Krait oxp from your sig.
Three of them jumped me. It looks good and has very strange lasers... took me by surprise.
Thanks Griff and Eric.

Is it complete? A few of these appeared in the log:

Code: Select all

[script.load.notFound]: ***** Could not find a script file named griff_krait_fuel_injectors.js.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

El Viejo wrote:
Is it complete? A few of these appeared in the log:

Code: Select all

[script.load.notFound]: ***** Could not find a script file named griff_krait_fuel_injectors.js.
Its complete, but that line should have been removed as that script is replaced by an other. I didn't realise griff used two templates and I only removed that line in the chrome version.
A corrected version is now uploaded.

What the new script does is actually remove the fuel-injection capabilities of the ship when you shoot off the fuel-injection subentity :lol:
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Post by Cody »

Thanks Eric.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
Post Reply