3D is becoming a major need in today's web scenario. I think it is absolutely the future of the user interface front-end.
In order to share our interactive 3D stuff across the internet we desperately need appropriate plug-ins with embedded rendering capabilities.
C'mon we're in 2008!
Recently Adobe® came out with the new Flash Player 10 (beta) and its
Astro 3D GPU stuff! Great. For how far you can push
your software rendering techniques and algorithms, the best performances can be obtained only via hardware rendering, and that's indispensable.
Sadly, Silverlight doesn't show the willingness to pursue this path right now (let us just wait and see what happens in the forth-coming future),
on the other end, the extensibility capabilities that the DLR together with the Visual Studio IDE permit may push someone to try to
experiment the software rendering road... someone it's me!
I've never tried before to build up a 3D engine for real-time rendering and I must admit: it's real fun. There are a lot of factors to
keep in count as you code and the amount of maths involved is challenging.
In the diagram above you can see an extract of the full class diagram for the API;
it misses all the vectors, matrices, quaternions and so-on-stuff which are very similar to those in WPF's PresentationCore assembly.
As a first sample test micro-app for my embrional engine I provided the following link (see picture below).
Several aspects are handled in there: hierarchical relations between visual objects, affine transformations, camera motion, directional lighting...
It is useful to keep in mind that the coordinate system I adopted is a left-handed one: with x-axis going left to right,
y-axis from bottom up and z-axis coming straight from the screen.
How to use it:
- use right and left arrows to rotate the polyhedra around the polar vertical axis of the group.
- use up and down arrows to move the camera around a circumference whose plane is the yz one.
Data about the camera elements are rendered in apposite textblocks positioned on the top left corner.
- you can roll-over the dodecahedron to see its material changing (interactivity with 3D objects).
Ok, you may ask "where's the code?"... I'd love to post some but:
- You can always hack it if you want! ;)
- I can't get rid of a memory leak that makes me crazy, so I better wait to solve this problem before posting any code...
Memory leak issue: my problem is that the
memory usage amount bubbles of several kB's as
transormations and consequent re-renderings occur. As far as I know there's no performance tool for Silverlight to use in these cases, so
I ported my whole API into WPF big daddy's world and everything seems to work fine. Even using
tools like WPFPerf I can't find the pits I'm looking for!
Maybe it's just about a beta 1 issue of Sllverlight that I'll hopefully see fixed in the next releases.
As a prove, see the exact same application running (in debug mode) in the following WPF app (deployed via ClickOnce technology).
Please note how my engine, if run in debug mode, shows useful objects like
- the face edges (black segments),
- the view frustum (rectangle in red),
- the face normals (straight from the dodecahedron faces),
- the faces' point of view rays (green lines which connect the eye of the camera to the barycenter of each face of the dodecahedron)
- numeric textblocks with informations like absolute position in world coordinates and distance from the camera eye.
Next steps are for my Pacem.Silverlight3D engine are:
- handling texture mapping (bitmaps),
- make the whole thing more performing.
See you soon...
Take care. Bye.
Feedbacks
-
Re: Silverlight 3D engine
Mateusz Kierepka (Sunday, May 25, 2008 10:53 PM)
“Nice! Btw. there is already project for 3D engine made in SilverLight on Codeplex - http://www.codeplex.com/Kit3D”
-
Re: Silverlight 3D engine
CMerighi (Sunday, May 25, 2008 11:21 PM)
“Thanks Mateusz!
Thank you also for pointing me to the Kit3D project. I just wanted (and still) to measure myself with 3D development to better understand what's behind this wonderworld...”
-
Re: Silverlight 3D engine
Whizzkkid (Monday, May 26, 2008 1:14 AM)
“Nice work, Though you might get a nicer rotation effect if you use an 'easeOut' method rather than an easeInOut everytime you press and hold the cursorkeys.
Also, I've created a 3d texturemapping routine that might help you out with your next steps :)”
-
Re: Silverlight 3D engine
Whizzkid (Monday, May 26, 2008 3:41 AM)
“Oh yeah, the texture mapping I made can be found here :
http://whizzkid74.blogspot.com/2008/04/texturemapping-in-silverlight-20b.html”
-
Re: Silverlight 3D engine
CMerighi (Monday, May 26, 2008 4:31 AM)
“Hi Whizzkid,
I've already seen the work of yours and fell in love with it... stunning effect! That will surely point me to the right direction!... thanks!”
-
Re: Silverlight 3D engine
Martin K. (Saturday, July 12, 2008 1:12 PM)
“I think your 3D engine and Demo is AWESOME !.. one of the best looking 3D demo's i've seen
there aren't many 3D apps in Silverlight yet... but i really hope that the future will make it easy to make 3D homepages !
I've made some semi 3D stuff here:
http://mdk2002.dyndns.org/Vector4_3
and some nice/funny stuff:
http://mdk2002.dyndns.org/HappyBirthday
http://mdk2002.dyndns.org/Critters
basically some kind of particle system :)
also check out www.bubblemark.com”
-
Re: Silverlight 3D engine
Roger Guess (Thursday, July 17, 2008 12:15 PM)
“Wow...
Any chance you have the demo updated for Silverlight 2?
Thanks!”
-
Re: Silverlight 3D engine
Roger Guess (Thursday, July 17, 2008 12:31 PM)
“So you also have the memory leak in the WPF version? Interesting. I have a memory leak with MediaElements in Silverlight 2 and have not taken the time to port to WPF for things like CLR profiling.
I'd still love a peek at the code though.. ;)”
-
Re: Silverlight 3D engine
CMerighi (Friday, July 18, 2008 1:02 AM)
“Hi Roger,
the memory leak issue is solved (and it didn't appear in WPF), it was about reusing brushes, shapes along their dynamic generation: looks like they weren't "disposed" by the runtime...
Now I'm struggling with performance matters (expecially with texture coordinates in meshes with thousands nodes) and with interactive functionalities (I'd like to avoid HitTest calculation and use standard UIElement events).
I did hope to deliver some code earlier, but I'm working on it...
See you soon!”
-
Re: Silverlight 3D engine
Asger (Tuesday, August 12, 2008 2:04 PM)
“Any news on publishing the code? :)”
-
Re: Silverlight 3D engine
CMerighi (Sunday, August 31, 2008 11:54 PM)
“...I'm waiting for the final release of SL2, to adjust the actual code and posting it all. Thanks for your interest!”
-
Re: Silverlight 3D engine
g2 (Thursday, September 18, 2008 12:30 AM)
“Hi,
I am new to silverlight but i wanted to used Silverlight to render graph on large no. of values.(in a range of million). Is the engine of silverlight good enough for this.. what are the limitation.
thank you.”
-
Re: Silverlight 3D engine
CMerighi (Tuesday, September 23, 2008 6:33 AM)
“Hi,
It may depend on what you have to do with all that load of stuff. If you need real-time manipulation, well... million of nodes are, AFAIK, pretty unmanageable also via unmanaged code. If it's about a one shot rendering process ...better announce it with a preloader! :)
I think that a 3D engine in SL managed code (software rendered) can bear a few (FEW) thousands of nodes, and it also depends on the type of textures, light algorithms you consider to use.”
-
Re: Silverlight 3D engine
xos (Monday, October 06, 2008 3:25 PM)
“Have you seen this Incredible 3D Engine for Flash Player ?”
-
Re: Silverlight 3D engine
xos (Monday, October 06, 2008 3:27 PM)
“the Sophie 3D Engine url: http://www.sophie3d.com”
-
Re: Silverlight 3D engine
cokkiy (Sunday, November 30, 2008 12:18 PM)
“Scott say 3D will be supported in Silverlight V3.”
-
Re: Silverlight 3D engine
CMerighi (Sunday, November 30, 2008 3:00 PM)
“Yep. I know it. Can barely stand the waiting!...”
-
Re: Silverlight 3D engine
C Chierchio (Tuesday, December 02, 2008 9:56 PM)
“Just tried looking at the 3D sample app, but informed that it doesn't support Silverlight 2..”
-
Re: Silverlight 3D engine
Simbu Aarumugam (Monday, December 29, 2008 11:22 AM)
“Where i can get your source code from your site..Because i want apply the directional light and ambiant light in my silverlight application please give the solution
In Kit 3D have DirectionalLight.cs file but it was Comments
But I remove the Comments it throws the errors how can we achieve AmbientLight, DirectionalLight in silverlight application .
And one more requirement is how can we rotate the object by mouse .like Kit 3D Tiger rotating by StoryBoard .I want to rotate the tiger by mouse drag(when I am dragging the mouse that tiger will rotated among with Mouse
Here WPF code for DirectionalLight and AmbientLight
<ModelVisual3D x:Name="AmbientLightContainer">
<ModelVisual3D.Content>
<AmbientLight x:Name="AmbientLight" Color="Blue"/>
</ModelVisual3D.Content>
</ModelVisual3D>
<ModelVisual3D x:Name="DirectionalLightContainer">
<ModelVisual3D.Content>
<DirectionalLight Direction="0,0,-1" x:Name="DirectionalLight">
<DirectionalLight.Transform>
<TranslateTransform3D OffsetX="0" OffsetY="0" OffsetZ="3"/>
</DirectionalLight.Transform>
</DirectionalLight>
</ModelVisual3D.Content>
</ModelVisual3D>”
-
Re: Silverlight 3D engine
Simbu Aarumugam (Monday, December 29, 2008 11:22 AM)
“Where i can get your source code from your site..Because i want apply the directional light and ambiant light in my silverlight application please give the solution
In Kit 3D have DirectionalLight.cs file but it was Comments
But I remove the Comments it throws the errors how can we achieve AmbientLight, DirectionalLight in silverlight application .
And one more requirement is how can we rotate the object by mouse .like Kit 3D Tiger rotating by StoryBoard .I want to rotate the tiger by mouse drag(when I am dragging the mouse that tiger will rotated among with Mouse
Here WPF code for DirectionalLight and AmbientLight
<ModelVisual3D x:Name="AmbientLightContainer">
<ModelVisual3D.Content>
<AmbientLight x:Name="AmbientLight" Color="Blue"/>
</ModelVisual3D.Content>
</ModelVisual3D>
<ModelVisual3D x:Name="DirectionalLightContainer">
<ModelVisual3D.Content>
<DirectionalLight Direction="0,0,-1" x:Name="DirectionalLight">
<DirectionalLight.Transform>
<TranslateTransform3D OffsetX="0" OffsetY="0" OffsetZ="3"/>
</DirectionalLight.Transform>
</DirectionalLight>
</ModelVisual3D.Content>
</ModelVisual3D>”
-
Re: Silverlight 3D engine
balu (Sunday, January 18, 2009 10:06 PM)
“hi
how can i create different shapes in this.i am looking to create complex 3d shapes.i am using kit3d dll.
regards
balu”
-
Re: Silverlight 3D engine
Heretic (Wednesday, May 06, 2009 6:58 PM)
“New fast 3d engine very cool http://infinity3d-engine.com”