Texture mapping On the Earth model

classic Classic list List threaded Threaded
5 messages Options
ahn
Reply | Threaded
Open this post in threaded view
|

Texture mapping On the Earth model

ahn
Hi. I am trying to implement the Earth model.

I am trying to map earth texture on a sphere.
I have two different textures one is a texture of the Earth and the other is a texture about night light of the earth.
So I need to map the texture together on a sphere depend on where the light come from.
(if it faces to light then normal texture opposite side is night light texture)

As I am newbie to JOGL and I am studying by myself not easy find out the way how to solve..
Could anybody comment how to solve on this??

(I guess, I can solve it by blending the two picture or something?)
Reply | Threaded
Open this post in threaded view
|

Re: Texture mapping On the Earth model

gouessej
Administrator
Hi

What is missing in my previous suggestion?
http://stackoverflow.com/a/27280769/458157

I don't think that you want to use the both textures at the same time. You can look at this example in WebGL, it can be ported to JOGL:
http://learningwebgl.com/blog/?p=1778

I admit that lighting is the aspect that I master the less in OpenGL. Maybe jmaasing, xranby or sgothel can give you a better answer than me.
Julien Gouesse | Personal blog | Website
ahn
Reply | Threaded
Open this post in threaded view
|

Re: Texture mapping On the Earth model

ahn
Thanks for the reply.
your previous suggestion was a lot helpful. :)
I've accepted your suggestion.
Reply | Threaded
Open this post in threaded view
|

Re: Texture mapping On the Earth model

jmaasing
In reply to this post by ahn
ahn wrote
Hi. I am trying to implement the Earth model.

I am trying to map earth texture on a sphere.
I have two different textures one is a texture of the Earth and the other is a texture about night light of the earth.
So I need to map the texture together on a sphere depend on where the light come from.
(if it faces to light then normal texture opposite side is night light texture)

As I am newbie to JOGL and I am studying by myself not easy find out the way how to solve..
Could anybody comment how to solve on this??

(I guess, I can solve it by blending the two picture or something?)
You should work through : http://www.arcsynthesis.org/gltut/
It is a good tutorial on shader based OpenGL. OpenGL is not easy, it takes a lot of learning to get started so you should be prepared to spend a lot of time with this.

In your case I would: make a triangle mesh based on a sphere, perhaps an icosphere like this: http://blog.andreaskahler.com/2009/06/creating-icosphere-mesh-in-code.html  and also calculate vertex normals for each vertex.

Armed with vertex normals for a triangle mesh your shader can can have two textures and calculate the angle (dot-product) between the light and the vertex normal to blend the day/light textures. It should be a calculation similar to Gouraud-shading http://en.wikipedia.org/wiki/Gouraud_shading 

ahn
Reply | Threaded
Open this post in threaded view
|

Re: Texture mapping On the Earth model

ahn
Thanks for the detailed explanation. I will try to implement with your advice. :)