On Sun, Aug 7, 2011 at 11:24 AM,  Thorsten Renk wrote:
> Upon further reflection - could it be the problem that I'm trying to
> assemble a layer rather than fill a volume?
>
> The bottom shading in 3dcloud.vert is controlled by a combination of
> 'shade' and 'cloud_height'. Your Nasal interface doesn't provide an option
> to set 'cloud_height' explicitly, so I'm assuming it's the box height
> determined from 'min-cloud-height-m' and 'max-cloud-height-m' as used by
> add-cloud.

Correct - the cloud is created with a width/height between the min/max values.

There are defaults, but I'm not sure they are what you are looking for! At
present they are as follows:

min-cloud-width-m, 500.0
max-cloud-width-m 1000.0
min-cloud-height-m, min-cloud-width-m
max-cloud-height-m, max-cloud-width-m
min-sprite-width-m, 200.0
max-sprite-width-m, min_sprite_width
min-sprite-height-m, min_sprite_width
max-sprite-height-m", max_sprite_width

I'm happy to change them to something else if it would be useful. I
suspect you might prefer the max values to always default to the min values?

> Now, in assembling a layer, I want the box to be essentially flat, i.e.
> just distribute textures on a layer with very little extension in
> altitude, such that the layer thickness is determined by the size of a
> single sprite rather than the box size, i.e. the sprite height is larger
> than the box height. See my cloud definition code below (it's all written
> into a hash first before  the property argument for cloud-add is
> assembled, but the parameter names are pretty similar - in case you're
> wondering, z-scale is just for my reference what should be there later and
> in my current experiments simply inserted into the shader by hand)
>
> if (subtype == "small") {var mult = 0.7;}
>                else {var mult = 1.0;}
>
> # characterize the basic texture sheet
> cloudAssembly.texture_sheet = "/Models/Weather/stratus_sheet1.rgb";
> cloudAssembly.num_tex_x = 3;
> cloudAssembly.num_tex_y = 2;
>
> #characterize the cloud
> cloudAssembly.bottom_shade = 0.4;
> cloudAssembly.n_sprites = 20;
> cloudAssembly.min_width = 1800.0 * mult;
> cloudAssembly.max_width = 2200.0 * mult;
> cloudAssembly.min_height = 1800.0 * mult;
> cloudAssembly.max_height = 2200.0 * mult;
> cloudAssembly.min_cloud_width = 2200.0 * mult * mult * mult;
> cloudAssembly.min_cloud_height = 50.0 * mult * mult * mult;
> cloudAssembly.z_scale = 0.5;
>
> Case in point - while min_cloud_height is just 50 m, the height of a
> texture sheet is 900-1100 m (originally twice that, but z-rescaling
> shrinks it again).
>
> I'm suspecting that somehow the shader doesn't expect that. Maybe cloud
> height as passed to the shader should be max(box_height, texture_height)?
> Or an optional parameter? In clouds_layered.vert, a hard-coded value of
> 1000 m works fine.

I think the problem is that you are expecting the cloud height to
indicate the location
of sprite centers, wherease the code is expecting it to be the height
of the actual
cloud.

The code actually _subtracts_ the minimum texture height from the cloud
height to determine where to place sprite centers.

So, the height should always be greater than the minimum texture height.
In your example I would suggest setting

cloudAssembly.min_cloud_height = 50.0 * mult * mult * mul +
cloudAssembly.min_height

That should at least help the problem, though there may be other bugs there too.

BTW - this is all up for discussion. Just because I wrote the default
3D cloud code this
way doesn't mean to say that it's the correct approach!

-Stuart

------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to