Advertisement

Possible to render a sphere map dynamically?

Started by November 25, 2019 02:59 AM
7 comments, last by DividedByZero 4 years, 9 months ago

Hi guys,

Just wondering it is is possible render a sphere map dynamically?

I was hoping it would as simple as setting the field of view to 360, but found that isn't the case.

I am guessing you'd need to apply a special type of projection matrix and not just the normal perspective matrix.

I have had a look around the internet but really can't find any information on this.

Does this mean that it cant be done? Or at least isn't a trivial task?

Thanks in advance :)

You can capture a cube map and tranform it to a spherical map.

A useful link:http://paulbourke.net/miscellaneous/cubemaps/

Advertisement

Thanks for the link.

It seems that is done via 3rd party utility at at first glance. I'll have a bit of a read and see if I can glean information to see if I can somehow do it real time.

Can't quote selectively because the editor won't let me ...

Setting the fov to 360° would result in a division by zero ;-)

Transferring a cube into a sphere always brings distortions with it.

I have no personal experience with this, my probably too naive question is wouldn't it be possible to render to a spherical map via cartesian coordinates obtained from spherical, e.g. stepping along the sphere hull from -90 to +90 lat and -180 to +180 lon ? It would probably be sufficient to choose one degree as a step, which i'd consider fast enough. Maybe one could even render different textures that way, one for each light source, and combine them ... ?

Green_Baron said:

Can't quote selectively because the editor won't let me ...

Setting the fov to 360° would result in a division by zero ;-)

Transferring a cube into a sphere always brings distortions with it.

I have no personal experience with this, my probably too naive question is wouldn't it be possible to render to a spherical map via cartesian coordinates obtained from spherical, e.g. stepping along the sphere hull from -90 to +90 lat and -180 to +180 lon ? It would probably be sufficient to choose one degree as a step, which i'd consider fast enough. Maybe one could even render different textures that way, one for each light source, and combine them ... ?



Thanks for the reply.

Even setting the FOV to something near 360 just results in a very zoomed out render.

I did consider your second suggestion there, which I might give a try. I'd suspect that it still may be a little slow for what I am looking at doing.

Because rasterization works by projection to a plane, 180 degrees is the (already breaking) maximum.

Also, for a non planar projection like sphere maps you would need ability to draw curved triangle edges. To do this on GPU it would work to tessellate the edges so they can form curves. I remember to have seen this in some GPU gems book, and they did this for GI using sphere maps. For some reason i can't find the article anymore, but i would not consider this to be very practical. (NV hosts the books online for free)

A fast way to generate many small sphere maps was shown in the Many LODs paper, using point hierarchies and splatting. (https://perso.telecom-paristech.fr/boubek/papers/ManyLoDs/ManyLoDs.pdf)

The easiest way is probably rasterizing 5 faces of a cube map. Only front face needs full resolution line 512x512, the other faces (left, right, top, bottom) would require only 128x512, because sphere map only covers a half space.
There is no distorition when projecting resulting cube map faces to sphere map, but varying sampling rate between the two needs some attention for best results.
However, using just the cube map as is should work as well.




Advertisement

https://developer.nvidia.com/gpugems/GPUGems2/gpugems2_chapter39.html

found the article

Nice JoeJ, thanks for the advice and links. Will have a read now.

This topic is closed to new replies.

Advertisement