World Wind Forums

Go Back   World Wind Forums > WorldWind JAVA forums > Feature Discussion

Feature Discussion Education, discussion and proposals of WWJ features

Reply
 
Thread Tools Display Modes
Old 06-16-2007, 06:13 PM   #1
tve
Member
 
Join Date: Jun 2007
Posts: 98
tve is on a distinguished road
Default SDK suggestion for lighting

I would like to see some minimalistic access to adjust lighting. For now I have modified SurfaceTileRenderer with the following. It would be nice to have a setAmbientLighting method or something like that....

Code:
    private float[] light_colors1 = { 3.0f, 3.0f, 3.0f, 1.0f};
    private java.nio.FloatBuffer light_col_ambient = java.nio.FloatBuffer.wrap( light_colors1 );
                //lighting 
            gl.glEnable(GL.GL_LIGHTING);

            gl.glLightfv(GL.GL_LIGHT1,GL.GL_AMBIENT, light_col_ambient);

            gl.glLightModelf(GL.GL_LIGHT_MODEL_AMBIENT,1.0f);
            gl.glEnable(GL.GL_LIGHT1);

            gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_COMBINE);
tve is offline   Reply With Quote
Old 06-16-2007, 07:42 PM   #2
fabrizio.giudici
Senior Member
 
Join Date: May 2007
Location: Milan, Genoa (Italy)
Posts: 112
fabrizio.giudici is on a distinguished road
Default

Can you post a screenshot? I'm curious about the result.
__________________
--
Fabrizio Giudici, Ph.D. - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
weblogs.java.net/blog/fabriziogiudici - www.tidalwave.it/blog
Fabrizio.Giudici@tidalwave.it - mobile: +39 348.150.6941
fabrizio.giudici is offline   Reply With Quote
Old 06-17-2007, 12:11 AM   #3
tve
Member
 
Join Date: Jun 2007
Posts: 98
tve is on a distinguished road
Default

Quote:
Originally Posted by fabrizio.giudici View Post
Can you post a screenshot? I'm curious about the result.
Sure, here is a post I made before. The lighing with settings of about 1.0f I think....
Attached Images
File Type: jpg paterson_dusk.jpg (146.2 KB, 365 views)
tve is offline   Reply With Quote
Old 06-17-2007, 04:06 PM   #4
tve
Member
 
Join Date: Jun 2007
Posts: 98
tve is on a distinguished road
Default fragment shader in SurfaceTileRenderer.java

Maybe a more flexible approach would be to implement the multi-texturing for tiles in a fragment shader as the comments in the source code elude to. I tried doing this with some success. I could pass in a sampler2D and get the tiles to draw, but I could not figure out how to the get alpha masking to work via a second texture unit. It does make drawing borders around the tiles extremely easy. This would also allow all kinds of really cool stuff like real-time color interpolated overlays like surface temperature for example.

After thinking about this more, it seems like just simple control over ambient lighting is not enough. For night simulations, you might want to have some kind of directional lighting for example.

I'm not suggesting that this should all be implemented in the core, but It seems like there has to be some clean way of implementing these things without requiring the SDK user to modify the core code.

Just some thoughts...

Last edited by tve; 06-17-2007 at 04:08 PM.
tve is offline   Reply With Quote
Old 06-17-2007, 11:51 PM   #5
patmurris
WWJ Consultant
 
patmurris's Avatar
 
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
patmurris is an unknown quantity at this point
Default

You need normals for the terrain vertices to get proper lighting/shading.
Not done yet.
__________________
My World Wind Java Blog & WW.net Plugins page
patmurris is offline   Reply With Quote
Old 06-18-2007, 01:46 AM   #6
tve
Member
 
Join Date: Jun 2007
Posts: 98
tve is on a distinguished road
Default

Quote:
Originally Posted by patmurris View Post
You need normals for the terrain vertices to get proper lighting/shading.
Not done yet.
I don't think you would need normals for what I have suggested so far, but aside from that, I guess I'm just pointing out the need to modify the SurfaceTileRenderer code to do any kind of lighting manipulation. Shaders would provide the most flexibility. I think just providing a mechanism to install a shader for the TileRenderer and maybe an example of how to implement the alpha masking in a shader would be enough
tve is offline   Reply With Quote
Old 06-18-2007, 04:08 AM   #7
patmurris
WWJ Consultant
 
patmurris's Avatar
 
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
patmurris is an unknown quantity at this point
Default

It sounds very interresting... i should look into shaders
What version of GPU shaders support would you need for this ?
__________________
My World Wind Java Blog & WW.net Plugins page
patmurris is offline   Reply With Quote
Old 06-24-2007, 02:59 PM   #8
tve
Member
 
Join Date: Jun 2007
Posts: 98
tve is on a distinguished road
Default

deleted

Last edited by tve; 07-02-2007 at 03:34 AM.
tve is offline   Reply With Quote
Old 06-25-2007, 05:02 AM   #9
patmurris
WWJ Consultant
 
patmurris's Avatar
 
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
patmurris is an unknown quantity at this point
Default

Quote:
Originally Posted by tve View Post
I'm just learning about all this myself. Modern video cards are definitely a technology to marvel at These procedural shaders are just the tip of the iceberg.
Talk about it! Nvidia is starting to offer supercomputer boards. In a few years from now we may well have realtime raytracing.
Quote:
btw, I looked at quite a few of the plug-ins you have done for WW... impressive! I'm not a dotnet guy, so I can't really follow, but you have been busy!
Can you tell i love WW ? Hopefully i will port a lot of it to WWJ, in a way or an other. Or maybe some other WW enthusiast will...

I'll have a look at your shader test bench... after i retire that aging GeForce4 MX i'm using. I'm a bit lagging on the hardware these days
__________________
My World Wind Java Blog & WW.net Plugins page
patmurris is offline   Reply With Quote
Old 08-24-2007, 07:37 AM   #10
what_nick
Worldwind Developer
 
Join Date: Jan 2006
Location: Hobart, Australia
Posts: 754
what_nick is an unknown quantity at this point
Default

Playing with shaders again not sure how to attach a texture to a named uniform sampler.
__________________
Coding This and That in World Wind and helping new people out, as long as they don't pester too much.
Currently blogging at: http://whatnicklife.blogspot.com
Working at:
Aerometrex - http://aerometrex.com.au/blog/
Impact so far:


what_nick is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Two suggestion for the online xml files Guest_Jim_* Suggestion Box 2 04-26-2007 11:36 PM
Running without the DirectX SDK bbreck Developers' Corner 10 02-07-2007 06:01 AM
a suggestion for the forums PostFatal_ Suggestion Box 9 12-04-2006 10:00 PM
Suggestion re 1.4 warnings and key chart nlneilson Suggestion Box 1 11-25-2006 04:14 AM
Plug-In using C++ SDK James_In_Utah Developers' Corner 1 11-05-2006 03:32 PM


All times are GMT +1. The time now is 10:33 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.