Hi Shahar,

I read this post and found it interesting. Just out of curiosity :

Each texel in the new texture, should be set based on the world location of
the corresponding texel in the current geometry texture

Are you trying to overlay a texture on top of txp archive and it should be
georeferenced? If so, there might be a different approach

Nick


On Tue, Jun 25, 2013 at 3:50 PM, Sebastian Messerschmidt <
sebastian.messerschm...@gmx.de> wrote:

> Hi Shahar,
>
> answers below.
>
>  Sebastian Messerschmidt wrote:
>>
>>> Hi Shahar Kosti:
>>> As you don't provide any exact numbers I can only guess. But usually I'd
>>> bind one or more textures per tile of paged set.
>>> Depending on your hardware bind of 8192x8192 textures is no problem.
>>> Can you be a bit more specific on how big the set is?
>>>
>>> Also for the hidden textures - I don't really get what you mean. My best
>>> guess is, that you mean not displayed.
>>> Therefore write a custom fragment shader and bind the data-textures
>>> along with you diffuse or whatever textures to the stateset of the tile.
>>>
>>> As the fragment shader is fully programmable, it is your choice what is
>>> done with the data.
>>>
>>> cheers
>>> Sebastian
>>>
>>>
>> Hi Sebastian,
>>
>> Sorry for my late reply, it took me some time to get the data.
>> One TXP I'm currently looking at, represents a 3000 kmĀ² area with texture
>> resolution of 5m/pixel. Some areas have better resolution, up to 10
>> cm/pixel. The additional metadata has similar resolution. So obviously
>> wouldn't fit on a single texture.
>>
> Okay, so the single TXP file represents the whole area? That's kinda hard,
> I thought you have multiple tiles representing parts of your complete data
> set.
> Anyways, First of all, your data sets need to be aligned somehow.
>
>
>
>> Regarding your suggestions, could you elaborate on the "bind one or more
>> textures per tile of paged set" approach?
>>
>> My current approach (which doesn't work), is to intercept paged nodes
>> using a custom ReadFileCallback, which runs a NodeVisitor. The visitor
>> finds all Geode objects and then the underlying geometries. I can bind a
>> new texture to these geometries, but I'm not sure how to set the values
>> correctly.
>>
> You don't really need to bind at a level this deep. Usually if the
> "terrain tile" is loaded and represent a LOD you want to work with, you can
> simple add your data texture(s) as uniform to the stateset of the tile.
> Given you have a texture with the data-image called "texture" you can do
> it this way in your callback:
>
> osg::StateSet* state_set = node->getOrCreateStateSet();
>     osg::Uniform* sampler = new osg::Uniform("MyDataSamper",  2 /*texture
> unit*/);
>
>     state_set->**setTextureAttribute(unit, texture
> ,osg::StateAttribute::ON);
>     state_set->addUniform(sampler)**;
>
> With this you bind the texture to a sampler for your shader, at the
> texture unit 2. Depending on how many textures are already bound you might
> need to modify the unit.
> In the fragment shader you can now access the texture via:
>
> uniform sampler2D MyDataSampler
> ..
> ..
>
> main()
> {
>     vec2 tex_coord = gl_TexCoord[0].st;
>     vec4 data = texture2D(MyDataSampler, tex_coord);
>
> }
>
>
>  Each texel in the new texture, should be set based on the world location
>> of the corresponding texel in the current geometry texture. I'm not sure
>> how to do that using the geometry vertex and texture coordinate indices.
>> I hope this is clear enough.
>>
> This is a different question. If your terrain-data already contains a base
> texture (like a satellite photo), the gl_TexCoord[0] might be matching
> already.
> If not you might want to use texture coordinate generation in the vertex
> shader to get world-space texture coordinates.
> It totally depends on your data.
> For a first try, I'd load a dummy texture for each tile and pass it to the
> gl_FragColor in the fragment shader to see how your coordinates are.
>
> cheers
> Sebastian
>
>
>> Thanks for the help,
>> Shahar
>>
>> ------------------
>> Read this topic online here:
>> http://forum.openscenegraph.**org/viewtopic.php?p=54810#**54810<http://forum.openscenegraph.org/viewtopic.php?p=54810#54810>
>>
>>
>>
>>
>>
>> ______________________________**_________________
>> osg-users mailing list
>> osg-users@lists.**openscenegraph.org <osg-users@lists.openscenegraph.org>
>> http://lists.openscenegraph.**org/listinfo.cgi/osg-users-**
>> openscenegraph.org<http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org>
>>
>
> ______________________________**_________________
> osg-users mailing list
> osg-users@lists.**openscenegraph.org <osg-users@lists.openscenegraph.org>
> http://lists.openscenegraph.**org/listinfo.cgi/osg-users-**
> openscenegraph.org<http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org>
>



-- 
trajce nikolov nick
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to