![]() |
|
|||||||
| Development Help Help for building applications or diagnosing problems with WWJ |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
WWJ Consultant
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
|
Following on my first try at a renderable layer for WWJ, i'm in the process of porting the Sky Gradient code too... but am having some kind of 'reference center' problem (not seen in the screenshot though).
![]() The code renders a sphere portion centered on the eye (camera) so that it intersect the globe exactly at the horizon. It is constructed at the origine, rotated to account for the camera position latitude and longitude, and then translated toward the camera. This code worked in WW and WW2DPlusOne and it works too in WWJ except the 'sky' sphere position seems to be 'shifted' by some amount and doesnt render in the right position. It gets better when the camera comes close to the ground. I'm wrondering if there is some sort of 'floating reference center' that should be accounted for at some point ? tag ? Note: i'm expecting some problems with the ellipsoidal globe since the sky geometry is a regular sphere here. I will deal with it after it falls in the right place first. ![]() Last edited by patmurris; 05-22-2007 at 08:34 PM. |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: May 2007
Location: Milan, Genoa (Italy)
Posts: 112
|
First of all, thank you for your posts! Using the previous one I was able to understand a lot about how to add "things" to the scenario.
I'm experiencing too some positioning problems. I'm exercising by writing a layer that draw parallels and meridians. I just modified your code and replaced the stars with a mesh. Now I managed to render a spherical grid, but: 1. the sphere is not centered with the Earth; 2. I had to use equatorialRadius() * 1.5 to roughly match the Earth radius Now I'll try to attach a screenshot.
__________________
-- 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 Last edited by fabrizio.giudici; 05-22-2007 at 08:28 PM. |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: May 2007
Location: Milan, Genoa (Italy)
Posts: 112
|
Here it is:
![]()
__________________
-- 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 |
|
|
|
|
|
#4 |
|
WWJ Consultant
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
|
I'm glad you could get started with the StarsLayer code
![]() Does your grid position shift when the camera moves or tilt ? Last edited by patmurris; 05-22-2007 at 08:35 PM. |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: May 2007
Location: Milan, Genoa (Italy)
Posts: 112
|
I don't know. Indeed it was my very first impression, but then you made me discover that its shifted. So it could be a perspective thing. Now I'll try to manually recenter it and let's see.
__________________
-- 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 |
|
|
|
|
|
#6 |
|
Senior Member
Join Date: May 2007
Location: Milan, Genoa (Italy)
Posts: 112
|
I've found this method:
Code:
Point pos = dc.getGlobe().computePointFromPosition(Angle.fromDegreesLatitude(lat), Angle.fromDegreesLongitude(lon), h); But there are problems still. Rotating the Earth, the meridians "slide" over the terrain ; if I tilt the view by means of shift+up/down, the grid completely detaches from the Earth ![]()
__________________
-- 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 |
|
|
|
|
|
#7 | |
|
WWJ Consultant
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
|
Quote:
We need tag advise here... |
|
|
|
|
|
|
#8 |
|
WWJ Consultant
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
|
Check the Polyline class in geom. It draw GL lines according to points positions (lat/lon/elevation). Cartesian corrdinates are computed with
Code:
dc.getGlobe().computePointFromPosition(p.getLatitude(),
p.getLongitude(), p.getElevation());
Code:
dc.getView().pushReferenceCenter(dc, this.referenceCenter); |
|
|
|
|
|
#9 |
|
WWJ Technical Manager
Join Date: May 2007
Location: Seattle
Posts: 459
|
Please post your graticule code and we'll try to help.
In order to achieve precision over great distances, most geometry is calculated relative to a local origin. But code that doesn't need to worry about very fine precision doesn't need to concern itself with that. At least we thought we designed it that way. A caution: A graticule is a lot more than lines around the globe. If you simply use lines some distance above the surface, the lines shift relative to the ground as you move. For me, the equator should touch the same ground no matter how I view it. Lines also pierce the terrain unless they're so far off the surface as to miss Mt. Everest, or they follow the terrain, which we implemented but decided was still unacceptable. We know what to do; we just haven't done it yet. |
|
|
|
|
|
#10 |
|
WWJ Consultant
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
|
Here is my actual version of the sky gradient (zip 3k).
I guess the way i compute cartesian coordinates and 'move' the geometry before drawing has something wrong. Maybe i dont use the right values from the current view... see comments in the source. If you can have a look. Thanks. |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| WWJ Early Access Release 0.2.0 now available | tag | WWJ Release Announcements | 48 | 09-19-2007 09:52 PM |
| Adding a star background layer to WWJ | patmurris | Development Help | 1 | 05-20-2007 11:18 PM |
| Add elevation color gradient to terrain mapped textures. | HalOlson | Developers' Corner | 3 | 04-10-2007 06:26 PM |
| Partial sky globe? Help | Unregistered | Technical Support | 2 | 06-04-2006 04:35 PM |
| Sky Gradient plug-in | patmurris | Add-ons & Scripts | 4 | 05-12-2006 05:53 AM |