Yep! I did it!
http://goo.gl/RjVHC (Goo.gl link so I can track how many clicks I get from this forum)
It uses quick shading to fill triangles, and a bit of trig to handle the rotation. However, culling does not work. If you know a good way to cull faces, please feel free to remix.
Thanks,
Hardmath
Offline
Oh, you finally figured out a method
I'm sorry to say, however, that if you tilt the cube at a standard isometric perspective (more or less) the draw order still messes up. (like so)
Also, it's flashy, and it appears to clear before it finishes drawing.
Offline
And, for the culling:
I honestly doubt you'll ever need any when rendering a cube. For other purposes, the methods will be way too slow (I think even the quickest way would have to loop through all the other polygons to determine whether they cover the one you want)... assuming you're talking about occlusion culling.
Offline
... I thought of an idea for a 3D engine. It would be deathly slow, but I think it might work. For each pixel, pretend it is like a ray coming from your eye. find where it hits a surface, and make the pixel on the screen that color. You could add extra variables to the surfaces, like shiny-ness, so you could bounce your ray off the surface you just touched onto another surface, where you would take that color and do some math with it to combine it with your other surface's color and so on. The problem is that I'm having trouble thinking of a way to see where a ray intersects a surface, or if it does at all. Could you help?
Offline
applejack wrote:
... I thought of an idea for a 3D engine. It would be deathly slow, but I think it might work. For each pixel, pretend it is like a ray coming from your eye. find where it hits a surface, and make the pixel on the screen that color. You could add extra variables to the surfaces, like shiny-ness, so you could bounce your ray off the surface you just touched onto another surface, where you would take that color and do some math with it to combine it with your other surface's color and so on. The problem is that I'm having trouble thinking of a way to see where a ray intersects a surface, or if it does at all. Could you help?
That's called ray tracing
Offline
So THAT'S what ray-tracing is. Thanks, there are so many different ways to make 3D. I learned something new! But I would still like an answer to my question
zubblewu wrote:
applejack wrote:
... I thought of an idea for a 3D engine. It would be deathly slow, but I think it might work. For each pixel, pretend it is like a ray coming from your eye. find where it hits a surface, and make the pixel on the screen that color. You could add extra variables to the surfaces, like shiny-ness, so you could bounce your ray off the surface you just touched onto another surface, where you would take that color and do some math with it to combine it with your other surface's color and so on. The problem is that I'm having trouble thinking of a way to see where a ray intersects a surface, or if it does at all. Could you help?
That's called ray tracing
Offline
Wow, cool!
Offline
applejack wrote:
So THAT'S what ray-tracing is. Thanks, there are so many different ways to make 3D. I learned something new! But I would still like an answer to my question
zubblewu wrote:
applejack wrote:
... I thought of an idea for a 3D engine. It would be deathly slow, but I think it might work. For each pixel, pretend it is like a ray coming from your eye. find where it hits a surface, and make the pixel on the screen that color. You could add extra variables to the surfaces, like shiny-ness, so you could bounce your ray off the surface you just touched onto another surface, where you would take that color and do some math with it to combine it with your other surface's color and so on. The problem is that I'm having trouble thinking of a way to see where a ray intersects a surface, or if it does at all. Could you help?
That's called ray tracing
You can check out this project by me for a simple raytracer.
Offline
I know! I did, but I was being lazy and "meh" like. I think that I'll try to make one on my own, so that I can learn how they work better. Your 3D projects are all awesome.
Hardmath123 wrote:
applejack wrote:
So THAT'S what ray-tracing is. Thanks, there are so many different ways to make 3D. I learned something new! But I would still like an answer to my question
zubblewu wrote:
That's called ray tracingYou can check out this project by me for a simple raytracer.
Offline
LS97 wrote:
And, for the culling:
I honestly doubt you'll ever need any when rendering a cube. For other purposes, the methods will be way too slow (I think even the quickest way would have to loop through all the other polygons to determine whether they cover the one you want)... assuming you're talking about occlusion culling.
I am talking about occlusion culling. Right now, I'm using a not-so-accurate method where I test the average Z positions. I am actively working on a better version though.
And yes, you do have to check each polygon against the other, making efficient occlusion tests is a hard CS problem which people are working on even today.
Last edited by Hardmath123 (2012-05-21 01:41:55)
Offline
Cool but when I turned the thing around, one part was rendered in front of the part that was meant to be at the front.
Offline
nathanprocks wrote:
Cool but when I turned the thing around, one part was rendered in front of the part that was meant to be at the front.
I know, that's the "depth testing" I've been ranting about since I posted this project. There are ways to get it right, but my closest approximation was 70 lines of hard-code recursive JavaScript and I'm not ready to Scratch it without being convinced there are better ways.
Offline
ZeroLuck wrote:
I like it, but why do you call this OpenGL?
Well, at some point I'm hoping to be able to read and evaluate OpenGL ES code.
Offline
Very good. I can't wait to see the new versions with bug fixes. :3
Offline
Thanks.
Offline
Almost too good to be just in Scratch! And 1 sprite 1 script, too!
And even though this is a slightly technical project, it does belong in Show and Tell. You could just mention "1S1S 3D graphics" in the title to attract people who don't know what OpenGL is.
Offline
Implement shaders...
Offline
scimonster wrote:
Almost too good to be just in Scratch! And 1 sprite 1 script, too!
And even though this is a slightly technical project, it does belong in Show and Tell. You could just mention "1S1S 3D graphics" in the title to attract people who don't know what OpenGL is.
I'm not so sure it goes in show and tell. In the past, projects like this were put in Advanced Topics, because of the advanced code. Y'know, because of the advanced-ness.
Last edited by gbear605 (2012-05-21 18:03:48)
Offline
scimonster wrote:
Almost too good to be just in Scratch! And 1 sprite 1 script, too!
And even though this is a slightly technical project, it does belong in Show and Tell. You could just mention "1S1S 3D graphics" in the title to attract people who don't know what OpenGL is.
I put this in the ATs deliberately, because this project uses hard math and tries to simulate a complex programming library. It's the kind of thing we Advanced Scratchers love, so I wanted to see how they would react, what questions they would have.
Another, bigger, reason was the fact that I was asking for the answer to a complex math problem (depth testing), and I was pretty sure I was only gonna get a response from our geniuses over at the ATs, not from people at the Show and Tell (no offense to the Show & Tell guys, it's just that I don't see much complex math around there).
So please move it back to the ATs. Thanks!
Offline
Hardmath123 wrote:
scimonster wrote:
Almost too good to be just in Scratch! And 1 sprite 1 script, too!
And even though this is a slightly technical project, it does belong in Show and Tell. You could just mention "1S1S 3D graphics" in the title to attract people who don't know what OpenGL is.I put this in the ATs deliberately, because this project uses hard math and tries to simulate a complex programming library. It's the kind of thing we Advanced Scratchers love, so I wanted to see how they would react, what questions they would have.
Another, bigger, reason was the fact that I was asking for the answer to a complex math problem (depth testing), and I was pretty sure I was only gonna get a response from our geniuses over at the ATs, not from people at the Show and Tell (no offense to the Show & Tell guys, it's just that I don't see much complex math around there).
So please move it back to the ATs. Thanks!
I'll buy those arguments
Offline
Paddle2See wrote:
Hardmath123 wrote:
scimonster wrote:
Almost too good to be just in Scratch! And 1 sprite 1 script, too!
And even though this is a slightly technical project, it does belong in Show and Tell. You could just mention "1S1S 3D graphics" in the title to attract people who don't know what OpenGL is.I put this in the ATs deliberately, because this project uses hard math and tries to simulate a complex programming library. It's the kind of thing we Advanced Scratchers love, so I wanted to see how they would react, what questions they would have.
Another, bigger, reason was the fact that I was asking for the answer to a complex math problem (depth testing), and I was pretty sure I was only gonna get a response from our geniuses over at the ATs, not from people at the Show and Tell (no offense to the Show & Tell guys, it's just that I don't see much complex math around there).
So please move it back to the ATs. Thanks!I'll buy those arguments
And in show and tell, you don't argue with mods.
Offline
Could some of the stuff on this blog help you?
(with the z-indexing)
Last edited by rookwood101 (2012-05-22 13:43:32)
Offline