[2.1] Dynamic geometry - dynamic quantity of vertices

Problems building or running the engine, queries about how to use features etc.
Post Reply
Slicky
Bronze Sponsor
Bronze Sponsor
Posts: 614
Joined: Mon Apr 14, 2003 11:48 pm
Location: Was LA now France
x 25

[2.1] Dynamic geometry - dynamic quantity of vertices

Post by Slicky »

I am trying to get to the point where I can have a changing amount of vertices. I have a feeling I will need to go through the initialisation each time I change the quantity. For now I am not changing the quantity of vertices and just trying to get it to work.

Questions:
(1) Do I need to reinitialise if I change the quantity of vertices originally declared?
(2) Would it work to initially declare an arbitrary number of vertices but just leave unused ones zeroed?
(3) Related to it not working yet - are the normals critical as far as seeing something rendered?
Slicky
Bronze Sponsor
Bronze Sponsor
Posts: 614
Joined: Mon Apr 14, 2003 11:48 pm
Location: Was LA now France
x 25

Re: [2.1] Dynamic geometry - dynamic quantity of vertices

Post by Slicky »

OK I made some progress (after a fair amount of time hassling).

It looks like it works to declare an arbitrary number and just use them or not.
For normals I set all of them to 1 since I am doing lines. If I used a lower number like 0.57 they either didn't appear of flickered.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [2.1] Dynamic geometry - dynamic quantity of vertices

Post by dark_sylinc »

Create your vertex & index buffers big enough to hold the maximum number of elements you expect them to contain (if you later need more, you'll need to recreate the buffers and the VertexArrayObject)

Once you've done that, use VertexArrayObject::setPrimitiveRange to limit how many vertices/indices you're actually using from the buffer.
Related to it not working yet - are the normals critical as far as seeing something rendered?
Yes. PBS requires normals, however Unlit does not.
Slicky
Bronze Sponsor
Bronze Sponsor
Posts: 614
Joined: Mon Apr 14, 2003 11:48 pm
Location: Was LA now France
x 25

Re: [2.1] Dynamic geometry - dynamic quantity of vertices

Post by Slicky »

I'll have to check but I'm probably using PBS. So far I'm just drawing lines.

(1) Is there a particular value I should use for normals? I know it is often calculated.
(2) Maybe I should look into how to change to unlit.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [2.1] Dynamic geometry - dynamic quantity of vertices

Post by dark_sylinc »

Slicky wrote: Sun Oct 28, 2018 6:32 pm (1) Is there a particular value I should use for normals? I know it is often calculated.
No. It has to be unit-length for proper PBR, but that's all.

For flat shading it's often calculated as (v0 - v1).crossProduct( (v0 - v2) );
Smooth shading tends to average the normals to make its smooth look, but there could be other algorithms.

For non-PBR scenarios, the value of the normal depends on what you're trying to achieve.
Slicky
Bronze Sponsor
Bronze Sponsor
Posts: 614
Joined: Mon Apr 14, 2003 11:48 pm
Location: Was LA now France
x 25

Re: [2.1] Dynamic geometry - dynamic quantity of vertices

Post by Slicky »

I got unlit working it wasn't too much of a change. The PBS version had black lines probably no material and my bad normals.
Post Reply