Solved

XNA Performance

Posted on 2011-09-02
3
551 Views
Last Modified: 2012-05-12
I'm learning XNA 4.0 at the moment.  I'm having an issue with performance already.  I created a cube class, that renders perfectly.  Then I created a class that creates an 3 dimensional array of said cubes.  When I run the game, I see the cubes.  Problem is performance.  I notice that the game is drawing cubes, that the camera can't see.  

My question is how can I determine if my TriangleStrips that I use to create the cube is within the camera's view?  

By asking this question I realized that, my problem is two fold.  I am Drawing my cubes using 3 nested for loops.  So, I'm drawing them based upon my for loops, and not from closest to my camera, outward, so I guess even a function that determined if the TriangleStrip is in fact viewable by my camera, it was only for that instance, until the next cube that would have blocked the view of that cube, was rendered.
0
Comment
Question by:Iamtehbest
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 12

Expert Comment

by:satsumo
ID: 36485926
How specific do you want the optimisation to be?  A regular 3 dimensional array of axis oriented cubes allows for lots of optimisations that don't apply in a more general case.
0
 
LVL 18

Accepted Solution

by:
Jose Parrot earned 500 total points
ID: 36499496
Seems that is a trouble with the fulcrum.
The fulcrum is the pyramid section defined by the observer (the pyramid's vertex), the vision planes determined by the height (one plane above, other below the observer) and width (left, right) of the field of vision and important: the near and the far planes (the far plane is the pyramid's base and the near the small base of the fulcrum).
Please note if the code treats these planes.

The variables in XNA are:
nearPlaneDistance - this is the distance to the near view plane. Anything that is closer than this value is not shown. You often set this to 1.0f
farPlaneDistance - this is the distance to the far view plane. Anything in your world that is further away than this will not be shown. So if your world is 100 units in size you will want this value to be at least 100. The actual value to use will depend very much on your game.

The same approach applies to the other planes.

Jose
0
 

Author Closing Comment

by:Iamtehbest
ID: 36515165
Worked.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I guess it is not common knowledge to most Wintel engineers/administrators: If you have an SNMP-based monitoring system in your environment (and it's common to have SNMP or Syslog) it's reasonably easy to enable monitoring of the Windows Event logs,…
What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question