Archived

This topic is now archived and is closed to further replies.

A little confused

This topic is 5971 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've never worked with HW Tnl before and I'm a little confused. Here's what's going on. I have a large flat (textured) rectangle. I also a much smaller (textured) rectangle about 300 to 400 units above the the larger one. The camera is placed above the smaller rectangle. So it should render the small rectangle over the larger one. The large rectangle is just plain textured and the smaller one is lightmap add. When I have PR_SetD3DPipeline(0) set it works fine and the small rectangle is drawn above the larger one as it should with it's lightmap add effect. However, with PR_SetD3DPipeline(1) the larger rectangle gets drawn ON TOP of the smaller rectangle. Why is this happening? It can't be a ZBuffer issue as the rectangles are upwards of 400 units apart. However, this problem occcures with all lightmap add items. They are getting drawn below the larger non-lightmap rectangle even though they are a great distance above it. Also I've noticed that wireframe doesn't work in TnL mode either. Is there a way to get the wireframe rendering in TnL without contstantly turning TnL on and off? Gary Edited by - Gary on August 6, 2001 6:20:10 PM

Share this post


Link to post
Share on other sites
Anything that uses the D3D pipeline is not sorted by depth. The whole point of having that pipeline is so you can send a big batch of triangles to the card at once and not have to mess around with individual triangles.

If you want to use lightmap_add or any alpha blending using the D3D pipeline you have explicitly render them in the order you want. In the case of lightmap_add, render those objects last.

Share this post


Link to post
Share on other sites
Ahhhh, ok thanks Chris I think I understand that better now.

I have a new question:

I know the D3D pipeline uses different data then the Power Render one. Lets say I just have a rectangle object and I''m adjusting the four corner vertices. I move these vertices in a certain way throughout the program. With the way the verts are moved the normals will never change nor any texture coords. Now, for the D3D pipeline, do I really need to call the PR_ConvertObjectToTnL each and every time I change the object (Is this even feasable?) or can I apply the changes manually to the D3D data. If so, how would I do it?




Also, any idea on the wireframe situation?


Gary

Share this post


Link to post
Share on other sites
Hi Gary

Here''s a reply to one of the many questions I asked chris on some issues of T&L versus non T&L.

Of interest to you might be this question I asked Chris:
Light maps don''t render when loading the pro objects into the pipeline.

Chris reply:

The lightmap example program doesn''t work with T&L because the lightmaps are generated after the initial .PRO file has been loaded. You''ll need to free and reconstruct the vertex buffers with the proper number of texture coordinates for that example to work in T&L. (PR_FreeD3DSegmentBuffer and PR_ConvertObjectToTnL

Original Post:
http://www.gamedev.net/community/forums/topic.asp?topic_id=54561


Doug

Share this post


Link to post
Share on other sites
Sovereign, Thanks for the reply. I did read that post but my question is a little different.

I''m changing the object but the changes are very minor. Only vertext positions. No normals are changed, no texture coords, no anything else. These vertex positions are being adjusted realtime and calling R_FreeD3DSegmentBuffer and PR_ConvertObjectToTnL every frame would be just to intensive. I''m wondering, that since the changes are so small, if I can make them to the D3D data directly and therefore be able to do it quickly.



Gary

Share this post


Link to post
Share on other sites
Chris, what''s the minimum required number of triangles in an object for the D3D pipeline to better than software pipeline?

I''m still putting planes [2 tris] thru software pipeline - is this correct?

If I make an object out of several planes - say a box
should this be software or hardware pipeline - I assume I use the total tris [12] rather than that it''s 6x 2 tri planes?

Thanks in advance for helping!
Petrovski

Share this post


Link to post
Share on other sites
You can lock, and modify, and unlock vertex buffers directly if you dig into the structures. If the object is small just use the software pipeline, unless you plan on rendering thousands of them.



Share this post


Link to post
Share on other sites
Ok, I want to see if I can maniplulate the data directly.
I''m a little unsure how this works with vertex buffer.

From what I''ve read on MSDN I think I need to do something like

VOID *VertData;

vb->lock (0, 0, (BYTE **)&VertData, 0);

** Do my changes **

vb->unlock ();


I''m a little confused, however, on the format of VertData. What format is it in, what do I need to typecast VertData into so that I can adjust the vertex positions?


Gary

Share this post


Link to post
Share on other sites
Ok, I found:

void *PR_LockVertexBuffer (LPDIRECT3DVERTEXBUFFER8 vb);
void PR_UnlockVertexBuffer (LPDIRECT3DVERTEXBUFFER8 vb);

which looks like it should lock and unlock the vb ok....
now on the data structure


It looks to me like the FVF is D3D_VERTEX_STAGED. However, my problem is that it only contains transformed vertex information. Now, I do have what the vertex positions should be in world space, I just need to get them into the transformed data.

I know the SingleTriangle example shows how to do this in the PR pipeline, but how should I do it for the D3D one?



Gary

Share this post


Link to post
Share on other sites
The pixel format will be this:

dwFVF = D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE;

and also the flag for the number of texture coordinates:
if (NumTexCoords == 1)
dwFVF |= D3DFVF_TEX1;
else if (NumTexCoords == 2)
dwFVF |= D3DFVF_TEX2;
...

D3D always uses a specific order for the elements. In this case it''s position, normal, diffuse color, then texture coordinates.

Share this post


Link to post
Share on other sites