View unanswered posts | View active topics It is currently Thu Sep 09, 2010 2:44 am



This section is under re-development. It is not finished, and not fully functional. The current development stage is pre-alpha and as such, not every feature is even implemented yet.




Options



rss Planet-Black0ps
rss Diagmato
rss From Wordpress



Users



Total entries:
Total comments:

Switching Between Projects

Diagmato, From Wordpress
Tue Oct 20, 2009 11:23 am

The weekend was good – I revisited some graphics programming, and after all this time, I had some catching up to do. Admittedly, I forgot exactly how to translate and rotate in XNA, and had to revise over an old camera class to spark my memory. It’s all good now though. I started the development of a sun – it moves across the sky, and, if you set the time of day, it will re-position the sun based on the time. This is no difficult feat though – there are 84,600 seconds in the day. The sun will be moving in a complete 360 degrees. So we convert the values from 0 – 84,600 to 0 – 360, and feed this function the time of day (in seconds).


The sun also does not behave so predictably colour-wise, however. So far, the sun has a static colour, which would be good for mid day, but bad for sunrise and sunset (and night time!). So for this, I have three colours – dawn, noon, and dusk. The time of day is used to interpolate between the colours as the sun moves across the sky.


Now comes something slightly more advanced. If the user wishes to position the sun manually, we need to do some collision detection. We use a bounding sphere the same size as the sun’s theoretical sphere (the radius is the distance from the world origin),  and then, with basic picking, see where the mouse’s pick ray intersects the sphere. The resulting coordinate is the new location for the sun, or it can be drag/dropped to avoid accidental replacement if the user accidentally clicks the sky. The value of the sun’s roll (the sun orbits the Z-axis – we have so far used +z for North, +x for East) is then converted to seconds in order to calculate the colour.


There are loads of concepts being queued up for the graphics work. The blessing of a hard but fun, rewarding task is also a problem elsewhere. Skinning models, calculating light, calculating procedural grass and terrains absolutely eclipses PHP work. Programming is fun when it is challenging, and PHP offers very little challenge – just monotonous coding, usually in slightly different ways. The biggest reward of website development is seeing people use the functionality and get something from your site. The best part of graphics is everywhere – you are creating your own worlds. There are so many concepts to get through that it offers a constant challenge.


Maths, in my opinion, is the greatest strength you can possibly bring to graphics programming. It is everywhere. It is complicated. My maths from school was pretty bad, and I can safely say that most the maths I’ve learned has come from graphics work. It is getting more understandable, but I really do wish I got into it back before things were so critical.



cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.