- Board as one plane
The first thought that pops into my head is to use a single plane, with a
MovieMaterial of a Sprite with all the squares you need. In some ways that
should actually prove more versatile than individual planes, because it should
be easier to fade the color of a single square rather than having a direct
color change. You can fade them to be highlighted, then fade them back to
normal. If the background has it's own View (not ownCanvas) then this shouldn't
require a render of your other objects.
- Separate views
ownCanvas pushes an object to its own layer, which is useful for rendering
sometimes (as are the push back and push front properties) but it will still
require every object in the scene to be rendered at once. I had to create
multiple View objects in order to render scenes independently, although I did
set them all to have the same camera object and same position, so they all
would share the same perspective.
If you render the dragging object by itself, it doesn't speed up the render
time for that object, but the whole render time is much faster because it only
needs to handle the one object, and not all your pieces. The side-effect is
that the piece will always be under or over all your other objects, since it is
in its own bitmap layer in Flash. To account for this, I reduced the alpha of
my dragging layer. Yes, there's a performance hit for using transparency, but
it was much faster this way than to render everything, and it prevented it from
looking weird and out-of-place. Of course, if you were in more of a top-down
perspective, transparency might not be necessary. In order to move the object
from one view to another, I did need to remove it from the display list of the
old view, render that view (so it would process the request), add it to the new
view then render the new view.
- Only render when stuff changes
I also noticed that Away3D doesn't always fire all mouse events without
rendering, so I had to call some type of method to force it to process mouse
events. I don't quite remember what it was off the top of my head. When
rendering on every frame, the mouse over and mouse out events worked correctly
for every object. However, without it running every frame, the mouse out and
mouse over only worked when the entire 3D scene was rolled on or rolled off.
Getting the nuances of which object in the 3D scene required that extra
function call to force it to process and dispatch those events
- Bake textures
There are lots of kinds of texture baking. For my use, I needed to do it at
run-time, so it basically consisted of combining the objects in a Sprite then
using the draw method to convert that into a Bitmap. I tried doing it at a
pixel-level, but it didn't work quite right with some of the transparency stuff
I needed it to handle.
- Poly count
If necessary, you might even start out having the pieces move instantly. You
click on a piece, it highlights your choices, you click where you want it to
go, and it jumps there and performs a new render. Shouldn't be bad on
performance even if you have a high poly count, then you can add animation
later if you're able to optimize the models a bit more.
On Mon, 03 May 2010 09:40:11 -0700, Michael Iv <[email protected]> wrote:
Most active you could possibly have found ; )
Sent from my iPhone
On May 3, 2010, at 7:39 PM, manno <[email protected]> wrote:
Ah, there's an active forum :)
Thanks for the tips
What I've already done:
* Renderer set to basic, though sometimes faces (random to me) are not
rendered I suppose this will have to stay that way, at least while
scene is static.
* Scene only renders when stuff changes (cam or objects)
What I'll try:
* Board as one plane. Though it won't be the largest possible
performance win :) Suppose with some bitmapdata stuff it shouldn't be
to hard. At max I need to hilight all the possible moves of the queen
on an empty board. But: does the number of segments needed for proper
texturing not negate the positive effect of one plane? To get the
straight lines of the squares, you can't go with, say, 2 segments.
Right?
* Look for Billboard replacements (Just found MovieClipSprite, could
that be an option too? Didn't understand the 'spherical' as mentioned
in the docs). Suppose the game could do with just one perspective in
camera's x-axis.
* seperate views. Pieces and board can be seperated, board is most
interactive, pieces toughest to render. However, having a seperate
view for a moving object as suggested, also changes the view with
static objects (the moving object is removed from it, right?). Does
rendering still benefit?
What I'll definitely need a good read on:
* ownCanvas etc. as suggested
* bake textures (perhaps just delegate to modeler). Are there more
references than the two videos on Fabian's site.
*
Delegate (phew ;) )
* Downscale the models in polycount
Screenshot is at:
http://groups.google.com/group/away3d-dev/web/chessboard.jpg
Thanks for all the input