Wednesday, 14 October 2009

WPF 3D, The Beauty of Mistakes

When I first coded graphical applications for Windows using GDI many years ago, one thing I discovered was that coding mistakes could often produce very attractive results, particularly when using things like bitmaps and ROP modes. Not as exciting as some of my first work controlling industrial machines, when a mistake could cause 3 tonnes of metal cutting equipment to crash into its end-stops at high speed, but pretty nonetheless.

With WPF 3D coding it's even better. When writing code I like to test things out as often as possible, and this is particularly beneficial with 3D work as often when trying to visualize things in 3D space it's just easier to build things up gradually. The sad thing is that the intermediate results often look better than the finished article, even if they are not correct. For example, this is a chart before the size of the radial elements was calculated.

This is an incomplete spherical element.
And this is the same item with a little more coding.

Another example of this is the use of normals to influence lighting and shading. I most often build up the mesh by creating the points and triangle indices first, viewing the results for correct positioning etc. While it's undoubtedly better to think about and hopefully calculate the normals at this time, I tend to do it afterwards. I'm then disappointed because although the appearance is definitely more correct, it's often not as attractive. The simple bar chart example below shows this.

The finished article had much better defined edges and smooth colours, but it definitely didn't look as nice!


At 24 December 2015 at 11:24 , Blogger John Peter said...

Great Article
C# Training
C# Training

C# Online Training
C-Sharp Training
Dot Net Training in Chennai
.Net Online Training

At 12 December 2016 at 09:17 , Blogger cisco ucs training said...

Thanks for posting this useful content, Good to know about new things here, Let me share this,cisco ucs training


Post a Comment

Subscribe to Post Comments [Atom]

<< Home