Jump to content
  • Advertisement
Sign in to follow this  
Dhaos

3D-Editor Coding Issues

This topic is 3685 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 have been building a simple 3d-editor and have run into several issues I am unable to resolve. ---------------------------------------------------------------------------------- 1)Preventing a vertice or polygon from being selected when it is not in view. ---------------------------------------------------------------------------------- I have no idea how one would go about this. Currently when you attempt to click in the view area, it tests every single object, vertices or polygons depending on the selection mode, within the model and selects the one closest to the viewer as well as any object that share the same X Y Z. I could make a "possible selection list" that would be refilled each time you rotate the camera, but again I am not sure how to test whether or not a given vertice or polygon is currently visible to the viewer. Perhaps something relating to back face testing? ---------------------------------------------------------------------------------- 2)How to hide individual or groups of polygon. ---------------------------------------------------------------------------------- Storing the hidden polygons in a list, shifting them to the end of a given object array when hidden and only drawing the first set (ex: those not hidden) via editing the number of polygons to draw. This method worries me from a performance standpoint. ---------------------------------------------------------------------------------- Is there a built in toggle for either of these? Testing wether or not a polygon or vertice should be drawn, and preventing a polygon or series of polygons from being rendered?

Share this post


Link to post
Share on other sites
Advertisement
1) Sounds like you could use a variation of the zbuffer idea as an alternative solution for this. Insert the ID number for the visible polygon into the zbuffer when the new z value is greater than that already in the buffer...

2) Doesn't sound that much of a performance hit to me, assuming your arrays are fixed size.

If all I was doing was looping through the list, without any need to index items within the list repeatedly, I'd use a linklist. I'd create a seperate linklist pointing to invisible polygons. I would make the polygons invisible by inverting its surface normal.

Share this post


Link to post
Share on other sites
For the first one, it sounds like you are trying to implement some sort of 3d picking.

One way to do picking would be to redraw the current view, but use a unique color for every object, vertex, or polygon. Then take the coordinates for the location the user clicked on the screen and get the color in the re-colored view. You can then use this color to determine which object they selected. This colored view would never actually be shown to the user, just used to determine what they clicked on.

It sounds like your current method will select an object if it is near the selected point as well - something this alternate method would not do. You might be able to increase the line/point screen draw size to larger than one pixel to help reduce this problem.

Share this post


Link to post
Share on other sites
@moosedude: I am unsure of how to gain access to the z-buffer information. Is there a function for this or something even more trivial that I am missing?

Also linked lists are out since the final output function for direct x only accepts arrays. Any additional information (the pointer to the next object) skews the rendering. Inverting the surface normal would create an issue if you hide a front polygon then hid a back polygon, you would then see the "hidden" polygons because they aren't truly invisible/removed.

@scottrick49: The color picking method sounds rather nice, however I never did figure out how you figure out the color of a given pixel. Could you elaborate more on how this would be setup?

Also I dont require the user to pick the exact pixel coordinate of the vertice, I have about a 14px square buffer that is also selectable.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!