Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / How do I spherify?

Author
Message
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 28th Dec 2012 15:12 Edited at: 28th Dec 2012 15:13
I have a sphere representing a planet and a texture for it. The problem is that the texture I generated doesn't go on the sphere in a way that looks good. I get bunching at the poles. I know what is causing the problem, I just want a good way to "spherify" the texture so that it doesn't appear bunched...... Any ideas?


The fastest code is the code never written.

Attachments

Login to view attachments
Dar13
15
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 28th Dec 2012 16:35
I've done some reason and it seems that the way to go would to use a cube map instead of a 2D texture. I haven't used DGDK in a while so I'm not sure how you'd go about doing it, perhaps you should use a shader?

Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 28th Dec 2012 21:32
For a planet model a geosphere is more appropriate. You may need to modify the texture to get it to map properly, but you don't have the problem with loads of intersecting edges causing problems with UV accuracy. Milkshape can create and export geospheres and I'm sure most other modellers can too.



WLGfx
16
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 28th Dec 2012 21:42
If you're generating your own spherical textures, I'm assuming that by the look of the image, then take a look at this I finally managed to figure out sometime ago: Seamless spherical texture generation

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 28th Dec 2012 23:15
@WLGfx: I'm trying to understand your code....
What is this line:

Are you simply generating noise here? How does this texture generation work. I don't have dbp on this machine, so I'm not sure how the texture looks (flat)....

I want to use it, but I don't know how to empliment it.

The fastest code is the code never written.
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 29th Dec 2012 10:48
While I think that impressive @WLGfx's solution is nearer to what you want, you can fix the poles of a texture using GIMP and some manual steps.

Quote: "For a planet model a geosphere is more appropriate."

Watch out because the mesh that you choose could be mandatory in the future for these basic setup features, so you would be tied to it.
I started using geospheres because they are more optimized, but in the long run, I reverted to regular DBPro spheres because of some little advantages solving an issue, and this had a cost.

Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 29th Dec 2012 11:27 Edited at: 29th Dec 2012 11:29
I am trying to "spherify" after generating the terrain in-game. I can't use another program to modify my images. I've looked at several possible solutions, but none worked. I came up with this:

but it's not perfect like what I see with WLGfx's example. I would use his, but I don't know what that one line is (ref previous post). I have a feeling it's VERY important to the outcome. Hopefully, when he gets on line, he will explain more clearly.

EDIT: my image size is 720x360

The fastest code is the code never written.
WLGfx
16
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 29th Dec 2012 17:25 Edited at: 29th Dec 2012 17:26
@Hawkblood - Yep, it's using 3D noise instead of the usual 2D noise to generate the texture. I just assumed by the look of the image that you were generating the textures yourself anyway. I can send you the C++ codes for the simplex noise functions if you like? You can then simply integrate them into your own code without any trouble.

The simplex and perlin algorithms are quite fast (especially the simplex) and the simplex algorithm uses a table based structure for speed too.

EDIT: I tried for yonks to convert a 2D texture to a spherical texture without pinching with no success.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 29th Dec 2012 19:33
I got something that kinda works, but I still have some bunching and a little distortion at the poles. I would love to know how simplex/perlin noise is generated. And I would like to know how you use 3D noise to generate a 2D image.... I've never done anything like this.

The fastest code is the code never written.
WLGfx
16
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 29th Dec 2012 20:47
Sent you an email, hopefully the right address. I'll email you the simplex noise code. Just use that the same as the DBP source code does for the 3D noise.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
WLGfx
16
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 31st Dec 2012 20:56 Edited at: 31st Dec 2012 20:57
For anyone who is interested, using the simplex noise code produces this as the spherical texture:

I never posted a screenshot in my snippet to show this...



Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!

Attachments

Login to view attachments
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 31st Dec 2012 22:46
This is interesting...

WLGfx - Any more magical tricks with that plugin It is just cool, but can you show it wrapped? [Around a Sphere...] Are there any tricks to it?

WLGfx
16
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 1st Jan 2013 19:53
http://forum.thegamecreators.com/?m=forum_view&t=198631&b=6

is where you will find all the neat little tricks...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 1st Jan 2013 20:22
True haha

Login to post a reply

Server time is: 2024-04-26 14:53:03
Your offset time is: 2024-04-26 14:53:03