Simul Support ExchangeCategory: CloudsIs truesky support rendering in wgs84 geographic coordinate system?
?? asked 11 months ago

hello,
I have purchase truesky IG produc and integrate in our C++ project based on osg earth, and I found that the cloud rendering is based on Cartesian system and not march our curvature terrain surface, and I can not make the continuous cloud appearance when travelling the whole round earth, so I wonder is there any way to make the cloud show corretly in a round earth coordinate like wgs84? I cheked cloudWindow class and try to solve but failed, someone can help me? thanks a lot!

2 Answers
Andrew Richards Staff answered 11 months ago

Hi,

Thank you for your question.
trueSKY 4.3 does have some support for WGS84 in the CloudWindow class for converting to and from local and WGS84 positions and directions. The CloudWindow only encompasses a localised area of weather on the global and its orientation is defined by a quaternion (with conversion to and from Lat/Lon/Hdg). It is also possible to move the cloud window on the global.
We are expanding the usage and scope of the WGS84 coordinate system and Global Weather within trueSKY 4.4.

We also have a Discord, if you’d like to discuss that issue there:
https://discord.com/invite/W2DNZ6fDfy

Best Wishes,
Andrew_Simul

?? replied 11 months ago

Yes I tried cloudwindow class and found the UpdateWindowCentre() function can move the cloud in some direction, I tried to use it to simulate the relative movement with camera travelling but found two problems:one is the dirention of cloud movement is not as supposed, two is the movement of cloud is not smooth (by some step), So I can not use it to make sommthly travelling across the whole earth.

Andrew Richards Staff answered 11 months ago

Hi,

When calling CloudWindow::UpdateWindowCentre(), you need to update the position of the camera as well, because CloudWindow will step by a single texel. This should address the unsmooth motion that you are seeing. See code below.

mouseHandler.Update(dt_seconds);
vec3 cam_pos = mouseHandler.GetCamera()->GetPosition();
vec3 newpos = cam_pos;
for (auto r : trueSkyRenderers)
{
	//[...]
	simul::clouds::CloudWindow& opt = r.second->GetSimulWeatherRenderer()->GetCloudRenderer()->GetCloudWindow();
	{
		// We will convert the camera position to a latitude/longitude.
		double lat = 0.0, lon = 0.0, hd = 0.0;
		opt.GetLatitudeLongitudeHeading(cam_pos, lat, lon, hd);
		// We will then pass that lat/long back to the CloudRenderer as our DESIRED centre point.
		// First we store the current origin.
		crossplatform::Quaterniond prev_origin = opt.origin;
		// Do the update. now origin may change:
		opt.UpdateWindowCentre(lat, lon, hd);
		// Then, we retrieve the ACTUAL lat/long/heading the CloudRenderer is using. Just need it as a quaternion:
		// If there's been a change, we reposition the camera to be relative to the new orientation.
		if (prev_origin != opt.origin)
		{
			newpos = simul::crossplatform::TransformPosition(prev_origin, opt.origin, cam_pos);
		}
	}
	mouseHandler.GetCamera()->SetPosition(newpos);
}

Best Wishes,
Andrew_Simul