Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (527)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (594)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  environmental mapping  (Read 1808 times)
0 Members and 1 Guest are viewing this topic.
Offline phu004

JGO Coder


Medals: 4
Projects: 9
Exp: 10 years


NoSuchPersonException


« Posted 2012-12-26 23:52:27 »

Hi guys, i am trying to write my own algorithm for environmental mapping. My approach is use a 6 faces cube map as the environment,  map the vertex of the polygon to the cube map, and then interpolate the texture position across the polygon during rasterization. My questions is how to deal with the situation where the vertices from a polygon were mapped in different faces of the cube map? Should I split the polygon to make sure all the vertices mapped in a single face or use some clever algorithm to cope with interpolation between 2 vertices that are mapped to different faces of the cube map?

Thanks in advance!
Pan

Offline theagentd

« JGO Bitwise Duke »


Medals: 361
Projects: 2
Exp: 8 years



« Reply #1 - Posted 2012-12-27 03:48:40 »

Isn't the whole point of the cube map texture type to just allow you to render a cube and have the texture automatically mapped to it?

Myomyomyo.
Offline phu004

JGO Coder


Medals: 4
Projects: 9
Exp: 10 years


NoSuchPersonException


« Reply #2 - Posted 2012-12-27 10:00:10 »

the main point of cube mapping is to create fake reflection of a shinny object with arbitrary shape. Traditionally realistic reflection is achieved by ray tracing, however this ray tracing is too slow for real time application.

With cube mapping, you map a surface from an object to a per-rendered cube map texture which was generated by rendering the scene 6 times from the view point of the object. This create an effect that the object is reflecting its surrounding environment.
 
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Danny02
« Reply #3 - Posted 2012-12-27 10:36:14 »

what the agent ment is that opengl provides you with an cube map texture type, which you provide with the six faces and which handles all the interpolation for you.

You don't upload six textures and then decide in the shader which one to use by yourselve.


Just google a bit around and you will find how to use it.
Offline phu004

JGO Coder


Medals: 4
Projects: 9
Exp: 10 years


NoSuchPersonException


« Reply #4 - Posted 2012-12-27 12:54:45 »

Yeah, i know there are 3d APIs out there that will do it for you. But I would like to "reinvent" the wheel by writing my own cube mapping algorithm.  Just to kill time during Christmas break  Smiley
Offline matheus23

JGO Kernel


Medals: 113
Projects: 3


You think about my Avatar right now!


« Reply #5 - Posted 2012-12-27 13:26:22 »

Seeing all the projects of phu004, it looks like he is writing a software renderer or something similar. He tries to implement Cube maps in his engine, which is supposed to be some kind of software-opengl.

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline phu004

JGO Coder


Medals: 4
Projects: 9
Exp: 10 years


NoSuchPersonException


« Reply #6 - Posted 2012-12-28 14:29:03 »

I am thinking about building  my environment map using Spherical coordinate system.  Interpolation between 2 points on a sphere is a lot easier than on a 6 faces cube map (since we no longer need to worry about the case where 2 reflection rays hit on different faces).    Environment map in Spherical coordinate can be easily generated by firing 360 * 360 rays at the center of the cube map.

Offline phu004

JGO Coder


Medals: 4
Projects: 9
Exp: 10 years


NoSuchPersonException


« Reply #7 - Posted 2013-01-02 13:36:11 »

I gave up the idea of building the environment map with spherical coordinate system. It turns out that interpolating 2 points on a sphere is a lot harder than i thought. 
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #8 - Posted 2013-01-02 14:25:08 »

It turns out that interpolating 2 points on a sphere is a lot harder than i thought. 

Have you tried using quaternions?

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Roquen
« Reply #9 - Posted 2013-01-03 07:11:49 »

You don't need to do anything special.  To sample a diffuse texture on the sphere, the normal points to the sample.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

PocketCrafter7 (14 views)
2014-11-28 16:25:35

PocketCrafter7 (9 views)
2014-11-28 16:25:09

PocketCrafter7 (10 views)
2014-11-28 16:24:29

toopeicgaming1999 (76 views)
2014-11-26 15:22:04

toopeicgaming1999 (67 views)
2014-11-26 15:20:36

toopeicgaming1999 (16 views)
2014-11-26 15:20:08

SHC (30 views)
2014-11-25 12:00:59

SHC (28 views)
2014-11-25 11:53:45

Norakomi (32 views)
2014-11-25 11:26:43

Gibbo3771 (28 views)
2014-11-24 19:59:16
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!