A Flash Developer Resource Site

# Thread: [as3][3d] little 3d texturing demo

1. A slight catch on the technical side, is that a curved path might crossover to unwalkable territory even if the linear spline did not. Since you've already padded/enlarged those regions with extra space anyway (Post# 05-30-2008 10:49 PM) , I think it'll be ok.

You might enjoy this link to deCasteljau's algorithm, it is a pretty elegant geometric-based algorithm for drawing bezier curves.

http://en.wikipedia.org/wiki/De_Casteljau's_algorithm#Geometric_interpretation

I'm guessing the path-smoothing algorithm takes place in screen space? One thing that has always bugged me is that (I think) the perspective transform of a bezier curve is not a bezier curve in screen space. However, (I think) a NURBS does map to another NURBS, when perspective transformed. This is only relevant if you're interested in decoupling pathfinding from camera positioning. (IE paths are all precomputed in world space, then projected to various screen spaces depending on which camera is active).

Cool work

2. I have an idea for the pathfinding. It seems like you're putting way too much effort into this by running all of the possible calculations, when you could just have a lot of it precalculated.

Now idk how you're doing this, with OOP or what, but you can basically just add all of the vector points into a matrix, and sort them according to distance. So you'd have an array for each point, that would reference its distance to the other points, and the respective path to be taken. You could precalculate all of this, and even spit it out as an external file if you wanted to, so that it wouldn't have to be recalculated for every user.

So if your lady starts at node 20 and is moving to node 4, you would simply go to matrix[20][4].path, and return the already precalculated path. You could cut your search time down to nothing.

The disadvantage: with 92 nodes, you'd have to have 92 x 92 arrays, unless you did it smartly, and only made a single connection between any two points. Eg. You wouldn't have matrix[4][20] and matrix[20][4]

3. @rachil0: that looks familar,
but even with that I´d not been perfectly helped in the beginning. Math has it´s own world - and its not easy to get into it.
Path is smoothed in 3d space,- no cheating even the path that gets executed in the end is in 3d space (x,y,z coordinates) because it matters for the objects or characters to be moved.

@Al Capwn: I had precalculation experiments in the past but the big con was that they were usually that resource intense that doing so on the client computer would be a pain to wait.
And if i´d do it on my computer and store it into arrays its only xtra work that I need to compile each time.
And like you already said yourself - an amazing big array that would be. Calculating the distance to a near node and comparing if it exceeds the current shortest path is propably faster as accessing a very big array and indexing it on each level load.
I expect some very complex level collision path´s exported from max for each level,- splitting that path up into what I just need for the current perspective works well for now. But thanks anyway for your input it gave me some thoughts.

some development,

the filesize made me some worries, knowing that more cameras would be added afterwards each with a color map and a alpha map for the clipping objects. So I had this idea of splitting colors and alpha into 2 separate image files with some advantages:

I implemented it like this in my xml:
PHP Code:
``` <obj id="mother" url="3d/3d_test_mother.3d" tex="tex/3d_test/3d_test_mother.jpg@3d_test_mother_alpha.jpg" ani="ani/mother.ani"/>  ```
the textures are assigned at 'tex'- a '@' sign splits them and tells my class that a seperate texture for the alpha channel is used. The path gets automaticly fixed if in the 2nd parameter the folder for example is missing.
If they have different sizes the alpha channel gets resized to the size of the color map.

4. have you tried making the images 8 bit

5. that wont give me the nice soft gradient in the alpha channel,- wont it?

its not like I´ll be using it for all textures or sprites just where it makes sense and I think that especially with the camera textures it will be very useful.

6. @ renderhjs
Man I could swear I saw some wicked level design screenshots a couple of hours ago

7. that wont give me the nice soft gradient in the alpha channel,- wont it?
8bit anti aliased .png files do a pretty good job of it.

8. I thought in PNG 8bit as a total means a indexed palette with a maximum of 256 colors, whereas if I take transparency just like GIF I have only a aliased alpha map (pixelart style) - or did I missed that wrong wit PNG?.
because usually I need to store it as 32 bit ARGB ([8]bit each channel = 24 color + 8 bit alpha), would be nice of couse if I could store the alpha as 8bit or less with indexed palette and colors as well.

9. 8bit anti aliased .png will give you 256 colours some of which will be used to feather the edges.
why do you need transparency anyway?
the model should naturally crop the image shouldn't it?

10. Regarding the precalculation...

If you precalculated it, and then stored it all as an XML file, you wouldn't have to compile it, and it would take very little actual space (a few kb, at most);

And the arrays might be really big, but the actual amount of memory it would consume would be very little. Even if it took up 100mb (I doubt it would even take 1), most computers these days have at LEAST 512mb, and referencing from memory is significantly faster than actually calculating the results (bitmap vs vector)

11. well perhaps the example is not the best (mother character) but in her case she needs it for her hair.
A better example are the lights in the renderings,- some of the lights will overlap the character - soft gradients are a must there.

updated demo:

online demo

changes:
- smoothed path
- pathfinding minor fixes
- alpha map of the mother is separate loaded
- texture baking test with the textures of the 3d character
- dark blur while pause
- demo filesize: 338 KB (!html)
- quickturn key: just some testing (space is btw. picking up)

textures in use:

12. why not post your (32bit transparent) image and i'll have a go at converting it to 8bit?

13. Think I found some bugs...
The first one is when you click like 10 pixels above point 14 your character keeps walking in some direction (depending where you came from), sometimes (mostly) even off screen and I can't get it back. Use camera 2.
The second one happens when returning from point 14, your character always does an unnecessary quickturn on point 13. Maybe it's about the unlucky number 13 but I think it's math after all

14. I´ve been playing with B-Splines and Subdevisions before but honestly never really understood the math of them
Try these formulas, I'm pretty sure they work. Specifically, C.R. spline is great for path smoothing, it would look somewhat like this in your case:

15. p.s. I wanned to ask this since forever... what's with their eyes? looks like bad solar bath attempt.

16. gr8

17. Nice work!

18. my first post in a long time,

that covers basically all the engine stages and the final demos I showed here at my university but did not uploaded for technical reasons.

19. Wow render that's impressive as. Game looks really interesting.

20. yay carrot pong!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

 » Home » Movies » Tutorials » Submissions » Board » Links » Reviews » Feedback » Gallery » Fonts » The Lounge » Sound Loops » Sound FX » About FK » Sitemap