A couple of weeks ago I presented a procedurally-generated sphere for Stage3D
. Today I have one more procedurally-generated model for you: a cylinder. Cylinders are useful for a variety of purposes, especially during debugging. For example, you can use them to show the direction a player’s gun is pointing or to construct a simple X, Y, Z axis display. Read on for the source code and a demo app!
Posts Tagged stage3d
Virtually every 3D app or game will need to support mouse or touch interaction with the 3D scene. Consider a real-time strategy game like StarCraft where clicking on units is essential to the gameplay. Check out the Stage3D
API and you’ll quickly realize that there’s zero functionality to handling mouse or touch events. So how do all of these games handle it? The answer is a technique called “picking” and this article will show you how to implement it.
The most common way to obtain the geometry of a 3D model is from a file output from a modeling package like 3D Studio Max, Maya, or Blender, but it’s not the only way. In the case of simpler forms of geometry it is practical to generate it yourself using AS3 code. When you do this you eliminate the needed download and gain the flexibility to scale up or down the complexity of the model on a whim. Today’s article shows some AS3 code to generate spheres for all kinds of uses: planets in space simulators, placeholders for debugging physics simulations, and whatever else you can dream up.
My article Stage3D Pipeline in a Nutshell is a conceptual journey through the phases of the 3D pipeline, but today I’m going to talk about the practical side. What code do you write if you want to transform points and vectors from one space to another? This article will show you how to do that.
Flash Player 11’s Stage3D
gives you only a few opcodes to do conditional logic and none of them are as effective as the good old if
in AS3. The most unique one of all is the KIL
opcode that discards the pixel being drawn. How does it work? How does it perform? Today we’ll find out!
This week’s article offers another useful utility function: indexedTrisToString
. This function is especially useful when dealing with 3D engines such as those based on Context3D.drawTriangles
or Graphics.drawTriangles
. It helps to untangle the complicated indices/vertices format that these API functions require into something much more readable and, therefore, debuggable.
Amazingly, everything you see in a Stage3D
scene is one of two very basic elements: the solid background color and a triangle. Yes, realistic portrayals of human avatars, fantastical renderings of futuristic spaceships, and every special effect you’ve ever seen are nothing more than cleverly-processed triangles. Just how are they so cleverly processed to get these effects? Today’s article takes you through the journey these triangles take from lowly three-sided shapes to building blocks of immersive experiences.
Now that we know how to use textures with an alpha channel in rendering Stage3D
scenes, let’s see if we can cut the performance cost so we can use them more often. Today’s article will show some tricks to optimize your rendering loop.
Stage3D
makes a lot of common tasks more complicated. One such task is using a texture/image that has alpha on it. With classic 2D Flash, this is done automatically for us. With Stage3D
, we must resort to some obscure tricks. Today I’ll show you those tricks so you can use alpha textures in your Stage3D
-accelerated Flash app.
While my three part series on draw calls in Stage3D
urged you to reduce them as low as possible, it didn’t give you much in the way of techniques for avoiding them. Sure, it had some good ideas for combining 2D sprite draws into a single draw, but how about 3D? Today’s article tackles the concept of “view frustum culling” to provide an automatic speedup to virtually any 3D app utilizing Stage3D
.