OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

TriangleStrip mesh is not smooth...


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
raider
Newbie


Joined: 14 Apr 2012
Posts: 15

PostPosted: Sun Jun 03, 2018 4:30 pm    Post subject:
TriangleStrip mesh is not smooth...
Reply with quote

Hi,

I have a TriangleStrip mesh that I use for a simple data collection app to show data changes in real time.

Most of the time the mesh looks very clean and smooth. However, sometimes the triangles look like spikes and not smooth. I do not understand why the mesh is broken by the spikes. Can you suggest a solution? Also my mesh is only 500 x 500 triangle, is there a better way to implement a mesh this size?


...

Thank you!

Cheers,
Mike[/img]
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11910

PostPosted: Sun Jun 03, 2018 5:11 pm    Post subject:
TriangleStrip mesh is not smooth...
Reply with quote

Hi Mike,

You don't provide any details about how you've created the mesh,
whether you've loaded it from some loader, you've use some util from
the OSG or other 3rd party tool or done it by hand yourself. Given we
know nothing about how you've created the mesh there isn't much can do
to help advice how to resolve the issues.

Robert.



On 3 June 2018 at 17:30, Mike Raider <> wrote:
Quote:
Hi,

I have a TriangleStrip mesh that I use for a simple data collection app to show data changes in real time.

Most of the time the mesh looks very clean and smooth. However, sometimes the triangles look like spikes and not smooth. I do not understand why the mesh is broken by the spikes. Can you suggest a solution? Also my mesh is only 500 x 500 triangle, is there a better way to implement a mesh this size?


...

Thank you!

Cheers,
Mike[/img]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=73927#73927








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
raider
Newbie


Joined: 14 Apr 2012
Posts: 15

PostPosted: Sun Jun 03, 2018 5:36 pm    Post subject:
Reply with quote

Hi,

Thank you Robert...

Here is how I create the mesh:

float column_x_loc = -(LAND_WIDTH * LAND_TRIANGLE_WIDTH)/2;
float column_z_loc = -(LAND_DEPTH * LAND_TRIANGLE_DEPTH)/2
float column_y_loc = DETAIL_TERRAIN_FLOOR;

for (int c = 0;c < LAND_WIDTH;c++)
{
for (int r = 0; r < LAND_DEPTH;r++)
{
(*terrain)[thisIndex][0] = column_x_loc;
(*terrain)[thisIndex][1] = column_z_loc;
(*terrain)[thisIndex][2] = column_y_loc;


(*terrain_colors)[thisIndex][0] = 46.0f/256.0f;
(*terrain_colors)[thisIndex][1] = 76.0f/256.0f;
(*terrain_colors)[thisIndex][2] = 100.0f/256.0f;
(*terrain_colors)[thisIndex][3] = 0.3f;

column_z_loc += LAND_TRIANGLE_DEPTH;
thisIndex++;
}
}

On an update I move all of the rows back one and replace the 1 row with new data.
I use a transparent_weight value to have older data disappear as it is updated.

float transparent_weight = 1.0;
float transparent_adjustment = 0.02;
for (int r = 0; r < LAND_DEPTH - 1; r++)
{
transparent_weight = 0.1;
for (int c = 1;c < 50; c++)
{
col_index = (c * LAND_WIDTH);
(*terrain)[col_index + r][2] = (*terrain)[col_index + r + LAND_WIDTH][2];
(*terrain_colors)[col_index + r][0] = (*terrain_colors)[col_index + r + LAND_WIDTH][0];
(*terrain_colors)[col_index + r][1] = (*terrain_colors)[col_index + r + LAND_WIDTH][1];
(*terrain_colors)[col_index + r][2] = (*terrain_colors)[col_index + r + LAND_WIDTH][2];
(*terrain_colors)[col_index + r][3] = transparent_weight;//(*terrain_colors)[col_index + r + LAND_WIDTH][3];
transparent_weight += transparent_adjustment;
}

}

The data at the first row is always smooth. I get missing triangles only in the middle or rear of the terrain.

Any suggestions are welcome. I have the program working the way I want if I can get this mesh problem solved.


Thank you again!

Cheers,
Mike
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11910

PostPosted: Mon Jun 04, 2018 8:27 am    Post subject:
TriangleStrip mesh is not smooth...
Reply with quote

Hi Mike,

You "kind of" specify how you are setting the vertex data but make no
mention of the way you pass this data to the OSG, or how you set up
your primitive data. What you have told us doesn't really tell us how
you are building the mesh, just hints about part of what you are
doing.

As a general comment, it kinds seems like an odd thing that are doing,
shifting and replacing rows for some reason is not normally how one
manages terrain. Could you take a step back and explain what you are
trying to achieve in your application w.r.t terrain, and why you have
adopted the approach you have. I ask this as it may well be that you
are trying to solve the problem in completely the wrong way. As I
don't know what you actually trying to achieve I can't provide any
guidance on this.

Cheers,
Robert.

On 3 June 2018 at 18:36, Mike Raider <> wrote:
Quote:
Hi,

Thank you Robert...

Here is how I create the mesh:

float column_x_loc = -(LAND_WIDTH * LAND_TRIANGLE_WIDTH)/2;
float column_z_loc = -(LAND_DEPTH * LAND_TRIANGLE_DEPTH)/2
float column_y_loc = DETAIL_TERRAIN_FLOOR;

for (int c = 0;c < LAND_WIDTH;c++)
{
for (int r = 0; r < LAND_DEPTH;r++)
{
(*terrain)[thisIndex][0] = column_x_loc;
(*terrain)[thisIndex][1] = column_z_loc;
(*terrain)[thisIndex][2] = column_y_loc;


(*terrain_colors)[thisIndex][0] = 46.0f/256.0f;
(*terrain_colors)[thisIndex][1] = 76.0f/256.0f;
(*terrain_colors)[thisIndex][2] = 100.0f/256.0f;
(*terrain_colors)[thisIndex][3] = 0.3f;

column_z_loc += LAND_TRIANGLE_DEPTH;
thisIndex++;
}
}

On an update I move all of the rows back one and replace the 1 row with new data.
I use a transparent_weight value to have older data disappear as it is updated.

float transparent_weight = 1.0;
float transparent_adjustment = 0.02;
for (int r = 0; r < LAND_DEPTH - 1; r++)
{
transparent_weight = 0.1;
for (int c = 1;c < 50; c++)
{
col_index = (c * LAND_WIDTH);
(*terrain)[col_index + r][2] = (*terrain)[col_index + r + LAND_WIDTH][2];
(*terrain_colors)[col_index + r][0] = (*terrain_colors)[col_index + r + LAND_WIDTH][0];
(*terrain_colors)[col_index + r][1] = (*terrain_colors)[col_index + r + LAND_WIDTH][1];
(*terrain_colors)[col_index + r][2] = (*terrain_colors)[col_index + r + LAND_WIDTH][2];
(*terrain_colors)[col_index + r][3] = transparent_weight;//(*terrain_colors)[col_index + r + LAND_WIDTH][3];
transparent_weight += transparent_adjustment;
}

}

The data at the first row is always smooth. I get missing triangles only in the middle or rear of the terrain.

Any suggestions are welcome. I have the program working the way I want if I can get this mesh problem solved.


Thank you again!

Cheers,
Mike

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=73930#73930








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
raider
Newbie


Joined: 14 Apr 2012
Posts: 15

PostPosted: Mon Jun 04, 2018 5:33 pm    Post subject:
Reply with quote

Hi,

"it kinds seems like an odd thing that are doing,
shifting and replacing rows for some reason is not normally how one
manages terrain. Could you take a step back and explain what you are
trying to achieve in your application w.r.t terrain"

I am just starting to develop a 3D app my usual domain is deep learning and searching. I saw a demo of OSG using a simple terrain and thought I could turn my boring 2D app into a sexy 3D app. I underestimated the effort involved. I use linux named pipe message queue to send real time data from my java application to my osg application. Once in osg I fill my terrain matrix as data is received. The shifting of rows is to move data from front to back as data is received. It works very well and much better than my old 2D user interface.

I started this tread trying to solve a mesh problem and fixed that problem by cleaning my original data much better. Now my terrain is looking very nice. Thank you for your comments that made me stop and look at data again.

Your comment 'this is not normally how one manages terrain'. Probably, what approach would you suggest to build a 3d mesh that is filled in real time? Can you point me to an example?

...

Thank you!

Cheers,
Mike
Back to top
View user's profile Send private message
cbuchner1
Appreciator


Joined: 14 Mar 2012
Posts: 315

PostPosted: Thu Jun 07, 2018 3:40 pm    Post subject:
TriangleStrip mesh is not smooth...
Reply with quote

Updating a mesh in real time could be done using some a displacement mapping in a vertex shader. The height field can be then updated as a texture.

The base mash would be essentially static and flat, but the z coordinate is updated on the GPU based on texture input.


Christian







2018-06-04 19:33 GMT+02:00 Mike Raider < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)>:
Quote:
Hi,

"it kinds seems like an odd thing that are doing,
shifting and replacing rows for some reason is not normally how one
manages terrain. Could you take a step back and explain what you are
trying to achieve in your application w.r.t terrain"

I am just starting to develop a 3D app my usual domain is deep learning and searching.  I saw a demo of OSG using a simple terrain and thought I could turn my boring 2D app into a sexy 3D app.  I underestimated the effort involved.  I use linux named pipe message queue to send real time data from my java application to my osg application.  Once in osg I fill my terrain matrix as data is received.  The shifting of rows is to move data from front to back as data is received.  It works very well and much better than my old 2D user interface.

I started this tread trying to solve a mesh problem and fixed that problem by cleaning my original data much better.  Now my terrain is looking very nice.  Thank you for your comments that made me stop and look at data again.

Your comment 'this is not normally how one manages terrain'.  Probably, what approach would you suggest to build a 3d mesh that is filled in real time?  Can you point me to an example?

...

Thank you!

Cheers,
Mike

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=73960#73960





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts EXTERNAL: Re: EXTERNAL: Re: Writing t... Rowley, Marlin R General 0 Wed Apr 18, 2018 2:31 pm View latest post
No new posts EXTERNAL: Re: Writing texture coordin... robertosfield General 1 Sat Apr 14, 2018 5:48 pm View latest post
No new posts Writing texture coordinates on a mesh... Rowley, Marlin R General 135 Sat Apr 14, 2018 1:48 am View latest post
No new posts Mesh Outline boulbo General 1 Tue Aug 22, 2017 4:10 pm View latest post
No new posts How to program the skinned mesh anima... lhx19950309 General 0 Sat Oct 08, 2016 10:12 am View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP