Page 1 of 1

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

Posted: Fri Jun 18, 2010 7:53 am
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

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

Posted: Fri Jun 18, 2010 8:59 am
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)

Posted: Fri Jun 18, 2010 9:04 am
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.

Posted: Fri Jun 18, 2010 9:11 am
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

Posted: Fri Jun 18, 2010 9:53 am
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.

Posted: Fri Jun 18, 2010 10:13 am
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.

Posted: Fri Jun 18, 2010 11:02 am
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

Posted: Fri Jun 18, 2010 11:29 am
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

Posted: Fri Jun 18, 2010 12:24 pm
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.

Posted: Fri Jun 18, 2010 3:00 pm
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.

Posted: Fri Jun 18, 2010 4:11 pm
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:

Posted: Fri Jun 18, 2010 4:20 pm
by Cody
Thanks Eric.