Print Story Modest 3D effects with SVG, version 2.1.
Diary
By NoMoreNicksLeft (Tue Mar 07, 2006 at 11:50:26 PM EST) svg, javascript, inverse kinematics, poser3d, html, web design (all tags)
I've updated the 3d rendering SVG applet. Instead of a single ugly triangle, you'll notice a 4x4 grid. Rotation is still borky.


This applet will eventually have a picture in it's background, and you'll need to position/place/stretch the grid to match certain parts of the picture. Floors, walls in certain situations. Maybe mirrors, probably the surface of water.

Also, check out newest applet. This isn't much yet, but eventually it will be an entire little stick figure. It's only doing inverse kinematics in 2 dimensions currently. I'm having trouble figuring out how to apply the math to 3 dimensions.

Instructions: Click and drag the green circle.

Anyway, one of the benefits of specifying the ground or floor in a photo will be to let the code help you position the stick figure. If we know where the floor is, then a nifty little javascript can help to ensure that people aren't floating around, or have their feet embedded in the floor. We also get to show how much of that person is under water.

On the stick figure, I've been thinking of a few ways to make it easier to use. I've always intended some basic interface that mimiced the important parts of Poser. For those unfamiliar with it, to the right of the human 3d model there were a set of dials, to allow you not only to fine tune the rotation or movement of whichever bodypart was selected, but also it's size. Still, it's going to take some skill to use, even if it's as easy as I hope.

So, I was also considering a dropdown list, with the names of as many as 20 or 30 base poses. Standing, sitting, kneeling, etc. Selecting any of these would position the stick figure in that pose instantly. Certainly doing this and making minor adjustments to that pose would be easier than trying to go from the "standing with arms outstretchde" pose every single time.

Still harder to decide yet, is whether an actual stick figure is going to be adequate. It's hard to tell which way it's facing with no depth cue. Also, there are some things that can only be done if I render an actual 3d mesh. It may be possible to fake more of a solid feel to it, without actual rendering. For instance, why draw a single line from hip to knee, or render out a few dozen triangles for that, when you could just draw an approximation of the thigh's outline with a freeform polygon (unshaded of course)? Still, how figure the silhouette without doing the actual rendering? Anyone have any insight on this?

Finally, anyone with any pointers or links to data on the average size/lengths of adult humans various proportions would be welcome. At some point, I'll need to know the length thigh and shin bones for people of various heights, and I don't think a tape measure and a full-length mirror will be much help.

< Attn: Fishkeepers | BBC White season: 'Rivers of Blood' >
Modest 3D effects with SVG, version 2.1. | 19 comments (19 topical, 0 hidden) | Trackback
Dear Sir, by komet (4.00 / 2) #1 Wed Mar 08, 2006 at 12:32:43 AM EST
you are completely and utterly insane.

Please keep up the work.

--
<ni> komet: You are functionally illiterate as regards trashy erotica.

I know it doesn't look like alot. by NoMoreNicksLeft (2.00 / 0) #2 Wed Mar 08, 2006 at 01:12:59 AM EST
But the 3d rendering one is math-complete. The matrix times vector, and matrix times matrix functions are simple, and fairly elegant for javascript, so I can quickly render an arbitrary number of points with minimal code. It's actually harder to import the XYZ coordinates for the points, than to render them. I'm thinking of maybe using JSON for it, haven't decided yet.

Supposing I can figure out IK in 3 dimensions, I'm probably only a day away from the crude version of the posable stick figure (minus joint constraints, it will need to be able to keep a knee from bending backwards).
--
Do not look directly into laser with remaining good eye.

[ Parent ]
Joint constraints? by gazbo (4.00 / 2) #3 Wed Mar 08, 2006 at 01:15:03 AM EST
Why are you discriminating against my favourite porn genre?

I recommend always assuming 7th normal form where items in a text column are not allowed to rhyme.

[ Parent ]
JSON: recommended by komet (2.00 / 0) #7 Wed Mar 08, 2006 at 04:57:08 AM EST
I suffer from acute Not Invented Here Syndrome, but JSON and the associated toolkits are just the way I like Open Source: well documented, easy to integrate into existing stuff, and quite possibly written by a programmer who grasps the concept of personal hygiene.

--
<ni> komet: You are functionally illiterate as regards trashy erotica.
[ Parent ]
I prefer JJSON. by ambrosen (2.00 / 0) #11 Wed Mar 08, 2006 at 11:12:31 AM EST
It only has an interface in K, but it can elegantly compress 3 million lines of Python into half a line of completely explicable natural language code. That's half an 80 character line, of course.

[ Parent ]
heh by komet (2.00 / 0) #14 Wed Mar 08, 2006 at 11:59:22 AM EST
I wonder what became of jjayson. He was completely off his rocker, but in an interesting way, and it's his fault alone that "learn K" has been on my to-do list for several years now.

--
<ni> komet: You are functionally illiterate as regards trashy erotica.
[ Parent ]
I think by celeriac (4.00 / 1) #4 Wed Mar 08, 2006 at 02:46:37 AM EST
we can eliminate all the tedious data entry if we just make lots of porn where the people are strapped into mocap rigs.

Dammit by DesiredUsername (2.00 / 0) #5 Wed Mar 08, 2006 at 02:49:49 AM EST
Stop teasing me with this SVG stuff. I spent about 20 minutes this morning trying (again) to get Seamonkey through the proxy and it just won't go.

---
Now accepting suggestions for a new sigline
Cool, it works by DesiredUsername (2.00 / 0) #10 Wed Mar 08, 2006 at 06:06:37 AM EST
Scaling doesn't do anything--bug or feature? Also, I don't have to click to move the image, so how do I leave the input area to change options? That is, when I move the mouse out, the image moves around.

---
Now accepting suggestions for a new sigline
[ Parent ]
Haven't gotten scaling to work either. by NoMoreNicksLeft (2.00 / 0) #13 Wed Mar 08, 2006 at 11:36:44 AM EST
What you describe is a bug, onmouseup it should release the "drag" but if you onmouseup outside of the SVG element, it doesn't catch it, so it keeps dragging. I need to fix that, but I only just now realized how, even as I was typing this.
--
Do not look directly into laser with remaining good eye.
[ Parent ]
White on white? by ana (2.00 / 0) #6 Wed Mar 08, 2006 at 04:24:14 AM EST
Or is it just blank? I'm using recent versions of Firefox on both Solaris and OSX boxes... same nothing, both times. I see boxes and stuff in the upper left of the first link, nothing for the 2nd.

Can you introspect out loud? --CRwM

Recent as in 1.5 or higher? by gazbo (2.00 / 0) #8 Wed Mar 08, 2006 at 05:19:44 AM EST
VML was only added in 1.5.  You'd hope that the OS shouldn't matter.

I recommend always assuming 7th normal form where items in a text column are not allowed to rhyme.

[ Parent ]
Um.. by ana (2.00 / 0) #9 Wed Mar 08, 2006 at 05:30:43 AM EST
1.5 on Solaris; 1.0.7 on OS X. Maybe there's an upgrade out there...

Can you introspect out loud? --CRwM

[ Parent ]
SVG, not VRML. by NoMoreNicksLeft (2.00 / 0) #12 Wed Mar 08, 2006 at 11:35:12 AM EST
1.07 definitely doesn't have SVG. 1.5 should be ok. Both use only SVG+javascript (3d is done in my own js code). If test9 works, test11 should also work.
--
Do not look directly into laser with remaining good eye.
[ Parent ]
Yeah, I meant SVG by gazbo (2.00 / 0) #15 Wed Mar 08, 2006 at 10:59:30 PM EST
VML (not VRML) is the equivalent vector technology in IE.

I recommend always assuming 7th normal form where items in a text column are not allowed to rhyme.

[ Parent ]
Really? by NoMoreNicksLeft (2.00 / 0) #16 Wed Mar 08, 2006 at 11:19:37 PM EST
That's fucked up. Thanks for the headsup though, I'll be googling VML tonight.
--
Do not look directly into laser with remaining good eye.
[ Parent ]
I'm having fun the other way by gazbo (2.00 / 0) #17 Thu Mar 09, 2006 at 12:14:38 AM EST
I have a body of code that has run fine on VML in IE for years.  Now Firefox supports SVG properly I'm trying to port it so it works on both.  The job of actually porting the VML code is pretty much trivial - the fun comes because Firefox in its wisdom only renders SVG if it's in an XML document.  And of course, if I just switch my doctype etc to XHTML, the entire fucking application breaks because XHTML renders things totally differently.

How irritating.


I recommend always assuming 7th normal form where items in a text column are not allowed to rhyme.

[ Parent ]
Hmm. by NoMoreNicksLeft (2.00 / 0) #18 Thu Mar 09, 2006 at 12:26:34 AM EST
Compound documents have to be XHTML. But can't you load the SVG in an iframe? I seem to remember doing that before I converted all of mine to XHTML.

And are you saying VML works in IE already (not a IE7+ thing) ? What versions? Is it as scriptable as the things I'm going? I'd much rather do that, than to try to support SVG in IE via the crappy adobe plugin. (Hell, can't we get some XSLT going to convert it automatically?)
--
Do not look directly into laser with remaining good eye.

[ Parent ]
I tried iframes and embeds by gazbo (2.00 / 0) #19 Thu Mar 09, 2006 at 12:38:57 AM EST
But the lines are very much part of the document, and scripted to be dynamically created, moved etc according to user interaction.  Which neatly answers your question about scripting.

VML's been in IE since at least 5.5 - it's actually a W3C spec IIRC, but it got ignored by everyone other than Microsoft.


I recommend always assuming 7th normal form where items in a text column are not allowed to rhyme.

[ Parent ]
Modest 3D effects with SVG, version 2.1. | 19 comments (19 topical, 0 hidden) | Trackback