Draw sprites in '3D'?

Monkey Forums/Monkey Programming/Draw sprites in '3D'?

slenkar(Posted 2014) [#1]
Im wondering if anyone has a system of rotating monkey images in 3D like 3D sprites? (with roll/pitch/yaw co-ordinates)

I dont want to use MiniB3D unless absolutely necessary because I like to use HTML5 but my PC cant run webgl. So everytime I compile I would have wait extra time for flash or GLFW to compile.


therevills(Posted 2014) [#2]
You could play with the matrix commands:
SetMatrix
PushMatrix
PopMatrix


zoqfotpik(Posted 2014) [#3]
That essentially requires texture mapped quads which can be done in software.

You can get a ghetto 3d rotation effect by varying the x and y scale, eg.

Scale sin(ticks),cos(ticks)

which should make it look like it is rotating in 3d.

One note about scale that's strange: if you set scale to 2,2 you have to set it back by setting it to .5,.5 because it is cumulative. I presume this is because Scale abstracts the matrix scaling commands so maybe popmatrix woukd fix it.

I have toyed with the idea of setting up software normal mapping for lighting effects. I think that should be possible with up-rezzing from a low resolution and might look pretty good.

At any rate I'm interested in this as well so let's discuss what we could do. I've had some ideas for simple 3d engines including a Comanche style fakevoxel terrain engine.


Nobuyuki(Posted 2014) [#4]
something like this?
http://nobuyuki.gpknow.com/lab/vectorball/

Once you have the points projected in 3d you can just use the DrawPoly overload to map a texture to a quad, if you want that sorta effect.


ordigdug(Posted 2014) [#5]
Nobuyuki, would you be willing to share your code for the above example?


zoqfotpik(Posted 2014) [#6]
Here's some Processing source for a vectorball effect. I agree that it would be nice to see Nobuyuki's.

http://luis.net/projects/processing/vectorball/vectorball.pde


slenkar(Posted 2014) [#7]
Yes that would be great, I only need 'quads' just the ability to alter monkey images to different 3d positions and rotations
(With parent child relationships)


slenkar(Posted 2014) [#8]
I think this works
(just rotates points so far)



Nobuyuki(Posted 2014) [#9]
Hi guys, sorry for not getting back to you right away. Here's the source code; it's old, ugly and you might not like it!



Rotation is Euler, prepare for gimbal lock

Edit: And here's the font



slenkar(Posted 2014) [#10]
thanks

I managed to get a polygon to rotate:

It seems to rotate every point around the co-ordinates 0,0,0 so I wonder how someone would change that?
I tried the undocumented textured polygon command but it didnt work


slenkar(Posted 2014) [#11]
I ripped out the matrix stuff from minib3d:





save it as Monkey/Modules/keef/matrix/matrix.monkey

then here is the demo