# Vrokulaf

Members

4

106 Neutral

• Rank
Newbie

• URL
1. ## Draw order depth

Yes, was just gonna write, I figured it out myself. I actually wrote it in the post even, and thought something like "Hey, I should actually try that out...".   If anyone is interested I can post the source code here, I wrote a very simple engine to handle the drawing order.
2. ## Draw order depth

Hi dudes.   So I don't really know what this particular thing is called, so I decided to call it "draw order depth" because it kindof describes what it is.   SO, I've been having some trouble figuring out this relatively simple thing, depth in 2D. So imagine you're a dude running around in a semi-tilted camera view (or isometric), and you want to run behind a tree or a house. What SHOULD happen is that the house should now be in front of you, obstructing the view for the camera. Very basic concept, things closer to the camera should be drawn last, so the things behind it gets drawn over (and that way, creating depth). I included an image illustrating what I'm talking about.     So it seems simple enough, but what is a good and efficient way of coding this? Is it putting everything in an array, and using an algorithm to sort them in order how far away from the camera they are, then just run through the list? If thats the case, how do you do it efficiently?   One thing I tried, but which took up way too much CPU, was to cut the screen up to slices horizontally, and go through every slice, check every object to see if they are positioned on that particular slice, and if they were, draw them. Were I thinking in the right direction?   Any answer is appreciated! Have a good one ~Vrokulaf
3. ## Calculating points behind camera

Hello guys.   I've been getting into crafting my own 3D-engine in Java (mostly for kicks, but also I like to have full control over everything I use). It's been going great for the most part (haven't gotten far), and I can now draw wireframes almost perfectly.   The formula I use for calculating where to draw a point on the screen is:   zDifference = abs(z - camera.z); screenX = camera.lens * (x - camera.x) / zDifference); screenY = camera.lens * (y - camera.y) / zDifference);   This works just fine, except for one thing. When the point goes back behind the camera, it completely stops working.   Ok, so obviously I shouldn't draw a point behind the camera, right? Problem solved? Well, almost...   Image a line, drawn between two points. Imagine walking past the first one, but the second one still being visible. When this happens, the line goes haywire, since the calculations for the first point stop working. So I can't just "not draw the point", since I need it to draw the complete line. I still need to calculate where on the screen (it will be off-screen, but still) this point should be drawn, so I can after that draw a line between the two.   You can check out and see the issue in-action here.   So, how should I go about fixing this? Is the formula completely stupid, or should I find a way to work around this issue?   Any response is greatly appreciated Have a good one, ~Vrokulaf
4. ## Professional composer looking for work!

Hello there! My name is Emil Ström, I have worked as a freelancer in this industry for about 4 years, and am currently looking for work! [b]EDIT: Please use the classifieds section to recruit projects. Thanks, Nate (moderator)[/b]