@MightyWanderer (MightyWanderer) posted a new topic, subject "ROBLOX Camera". It read:

   Devious and I were talking and I decided to make a camera.
    
    ROBLOX
    
    ### kewl camera
    
    Check out kewl camera. It's one of the millions of unique, user-generated 3D experiences created on Roblox.

After which, @TheNexusAvenger (Nexus) added

    Buddy249950 looks so pretty with your camera!

Then @MightyWanderer (MightyWanderer) said

    Yeeah, unfortunately hats come up as grey blobs. xP
    
    Are the angle illustrators not going away properly? They should disappear when you unequip.
    
    Anything I should change/add?

After which, @sleitnick (sleitnick) added

    If you're using raycasting, I'm pretty sure FindPartOnRay returns the surface normal that it hit. Using that, you might be able to do a bit of “shading” to the image to make objects appear correct in 3D space. I don't know much about how all of that works though, but it would be cool to try.

After which, @MightyWanderer (MightyWanderer) added

    > If you're using raycasting, I'm pretty sure FindPartOnRay returns the surface normal that it hit. Using that, you might be able to do a bit of “shading” to the image to make objects appear correct in 3D space. I don't know much about how all of that works though, but it would be cool to try. 
    
    Good idea. Done.

After which, @MightyWanderer (MightyWanderer) added

    I updated it a bit more - here are some screenshots of it with shading.

Then @ZhaoDan (ZhaoDan) said

    work with projection instead, and use triangles to mock up faces on the Parts, that way you won't be pixel limited, and you won't need to ray trace- even still, it's a pretty neat project, what framerate are you getting?

Then @AxisAngle (AxisAngles) said

    > work with projection instead, and use triangles to mock up faces on the Parts, that way you won't be pixel limited, and you won't need to ray trace- even still, it's a pretty neat project, what framerate are you getting? 
    
    Raytracing is what people do when they do complex lighting for movie renders and stuff.

To which @MightyWanderer (MightyWanderer) replied

    > work with projection instead, and use triangles to mock up faces on the Parts, that way you won't be pixel limited, and you won't need to ray trace- even still, it's a pretty neat project, what framerate are you getting? 
    
    I get a framerate of ~30 the entire time (even during rendering) except when taking the picture (which, even on the HD setting, is <10 seconds), where it drops to ~21.
    
    I don't understand how I would do what you're suggesting, could you elaborate a bit more?

So @AxisAngle (AxisAngles) replied

    > work with projection instead, and use triangles to mock up faces on the Parts, that way you won't be pixel limited, and you won't need to ray trace- even still, it's a pretty neat project, what framerate are you getting? 
    
    I get a framerate of ~30 the entire time (even during rendering) except when taking the picture (which, even on the HD setting, is <10 seconds), where it drops to ~21.
    
    I don't understand how I would do what you're suggesting, could you elaborate a bit more?[/quote]
    
    Don't do that. You'd need to zbuffer and stuff. And you have to do that on a er pixel basis. So… yeah
    
    Also I started working on something about 45 minutes ago:
    
    So I figured out that you can just geometrically integrate the transparency from 0 to the distance the ray travles through the part (the solved geometric integral is just Transparency^Distance) and it will get you the true transparency of that point through the part. I'mma add that.

Then @ZhaoDan (ZhaoDan) said

    the whole point of projection is that it isn't per pixel, and it would cut you render time way down, and it being roblox, per poly shading wouldn't be bad
    
    the method I'm suggesting would be to:  
    1-break the parts into faces  
    2-project the points of the faces into camera space  
    3-render the faces youself, or use someone else's renderer, like zGl (if you rendered yourself, use two right angle triangles stretched to form a trig, and a quad is just two trigs)
    
    That will cut a ton on how much rendering (and take the ‘taking the picture' step down to less than 1/20th of a second) you're doing, and don't forget to backface cull, and re-use the triangles as much as you can
    
    Another advantage is infinite resolution with no performance drop, where if you increased resolution in your current per pixel method, performance would be terrible.

After which, @AxisAngle (AxisAngles) added

    No. It doesn't matter what technique you do to get an image on the screen, you still have to display it on a screen which is made out of pixels. and if you take a shortcut and don't cull the parts of triangles which are behind parts other triangles, you get terrible results with triangles overlapping other triangles where they shouldn't be.
    
    When you're rendering a triangle, you have to run through each pixel that the triangle is on. Because it is highly possible that a triangle passes through another triangle, you check to see which triangle is closer when rendering. This is done on a per pixel basis when drawing the triangle.
    
    Regardless of the technique, whether it's triangle projection or raytracing, you will need to have pixels to do it right. It's just that the raytracing method can return beautiful results.

So @ZhaoDan (ZhaoDan) replied

    [quote] No. It doesn't matter what technique you do to get an image on the screen, you still have to display it on a screen which is made out of pixels. and if you take a shortcut and don't cull the parts of triangles which are behind parts other triangles, you get terrible results with triangles overlapping other triangles where they shouldn't be.
    
    When you're rendering a triangle, you have to run through each pixel that the triangle is on. Because it is highly possible that a triangle passes through another triangle, you check to see which triangle is closer when rendering. This is done on a per pixel basis when drawing the triangle.
    
    Regardless of the technique, whether it's triangle projection or raytracing, you will need to have pixels to do it right. It's just that the raytracing method can return beautiful results. [/quote]
    
    I said above “and don't forget to backface cull”
    
    If triangles are ImageLabels on a Surface Gui, the resolution will be higher than your viewport will pick up
    
    For intersections, you could clip the triangle where it intersects, and render it as two separate polys

Then @AxisAngle (AxisAngles) said

    [quote] No. It doesn't matter what technique you do to get an image on the screen, you still have to display it on a screen which is made out of pixels. and if you take a shortcut and don't cull the parts of triangles which are behind parts other triangles, you get terrible results with triangles overlapping other triangles where they shouldn't be.
    
    When you're rendering a triangle, you have to run through each pixel that the triangle is on. Because it is highly possible that a triangle passes through another triangle, you check to see which triangle is closer when rendering. This is done on a per pixel basis when drawing the triangle.
    
    Regardless of the technique, whether it's triangle projection or raytracing, you will need to have pixels to do it right. It's just that the raytracing method can return beautiful results. [/quote]
    
    I said above “and don't forget to backface cull”
    
    If triangles are ImageLabels on a Surface Gui, the resolution will be higher than your viewport will pick up
    
    For intersections, you could clip the triangle where it intersects, and render it as two separate polys[/quote]
    
    Let me draw you a few cases you have to handle.
    
    52236d7696dc904a3c2fe69ea7cdce38.png509×561
    
    This is a major pain in the butt to do.

So @ZarsBranchkin (ZarsBranchkin) replied

    ZIndex 10 isn't the worst problem, but the cutting ones definitely are.
    
    For ZIndex, you can simply have a bunch of GUIs stored in a table, and use them in what ever order you wanted.

@Oseday (Oseday) replied

    Z-buffer isn't a hard thing to do. You need to store the magnitude to you in the pixel data and when you try to update the same pixel data, you just compare the magnitudes and based on that you either update the pixel data or not. You'll use tables to store the pixel data.
    
    I'll try my best to help you guys out.
    
    And if you want, I can open-source my rendering to you people. It has shadow smoothing with object surface light reflecting but they're done poorly. It can render any bump-maps and textures/decals from internet in PNG format including their transparency alpha… I was also thinking about anti-aliasing, bloom and those stuff. They're easy to make but I need some time. Probably in the summer…
    
    Without Surface light reflecting.
    
    With Surface light reflecting.
    
    With Surface light reflecting. All the materials have their bump maps. And you can see that decals are also being affected by the bump map also.
    
    We can see how bump maps act on reflective objects.
    
    Without debugging “mode”.
    
    CLOSER!

To which @MightyWanderer (MightyWanderer) replied

    Thanks for the tips, guys. I'm not sure I completely understand, though. Axis, what do you mean by the transparency of the object? I'm not familiar with this.

@ZhaoDan (ZhaoDan) replied

    [quote] [quote=“AxisAngle” post=135937]No. It doesn't matter what technique you do to get an image on the screen, you still have to display it on a screen which is made out of pixels. and if you take a shortcut and don't cull the parts of triangles which are behind parts other triangles, you get terrible results with triangles overlapping other triangles where they shouldn't be.
    
    When you're rendering a triangle, you have to run through each pixel that the triangle is on. Because it is highly possible that a triangle passes through another triangle, you check to see which triangle is closer when rendering. This is done on a per pixel basis when drawing the triangle.
    
    Regardless of the technique, whether it's triangle projection or raytracing, you will need to have pixels to do it right. It's just that the raytracing method can return beautiful results. [/quote]
    
    I said above “and don't forget to backface cull”
    
    If triangles are ImageLabels on a Surface Gui, the resolution will be higher than your viewport will pick up
    
    For intersections, you could clip the triangle where it intersects, and render it as two separate polys[/quote]
    
    Let me draw you a few cases you have to handle.
    
    52236d7696dc904a3c2fe69ea7cdce38.png509×561
    
    This is a major pain in the butt to do.[/quote]
    
    You make it seem so hard, zindex is no problem, just add all the triangles in order, and forget zindex even exists
    
    for all the intersection problems, just cut the triangle on the line where the two planes intersect, that solves 100% of you issues, I'm surprised you even wrote that reply

Then @Oseday (Oseday) said

    [quote] [quote=“Weeve” post=136031][quote=“AxisAngle” post=135937]No. It doesn't matter what technique you do to get an image on the screen, you still have to display it on a screen which is made out of pixels. and if you take a shortcut and don't cull the parts of triangles which are behind parts other triangles, you get terrible results with triangles overlapping other triangles where they shouldn't be.
    
    When you're rendering a triangle, you have to run through each pixel that the triangle is on. Because it is highly possible that a triangle passes through another triangle, you check to see which triangle is closer when rendering. This is done on a per pixel basis when drawing the triangle.
    
    Regardless of the technique, whether it's triangle projection or raytracing, you will need to have pixels to do it right. It's just that the raytracing method can return beautiful results. [/quote]
    
    I said above “and don't forget to backface cull”
    
    If triangles are ImageLabels on a Surface Gui, the resolution will be higher than your viewport will pick up
    
    For intersections, you could clip the triangle where it intersects, and render it as two separate polys[/quote]
    
    Let me draw you a few cases you have to handle.
    
    52236d7696dc904a3c2fe69ea7cdce38.png509×561
    
    This is a major pain in the butt to do.[/quote]
    
    You make it seem so hard, zindex is no problem, just add all the triangles in order, and forget zindex even exists
    
    for all the intersection problems, just cut the triangle on the line where the two planes intersect, that solves 100% of you issues, I'm surprised you even wrote that reply[/quote]
    
    Do you even know how to detect that line? And now you're talking about cutting it. This'd make it very inefficient. That's completely not how you do it.

@ZhaoDan (ZhaoDan) replied

    plane/plane collision (super simple computation), and then cutting it is just rendering 2 extra trigs


{'source': 'discourse', 'url': 'https://devforum.roblox.com/t/roblox-camera/12421', 'title': 'ROBLOX Camera', 'views': 129, 'has_accepted_answer': False, 'word_count': 2273, 'like_count': 1, 'reply_count': 12, 'participant_count': 7, 'posts': 20, 'tags': '', 'author': '@MightyWanderer (MightyWanderer)', 'participants': '@MightyWanderer (MightyWanderer), @TheNexusAvenger (Nexus), @sleitnick (sleitnick), @ZhaoDan (ZhaoDan), @AxisAngle (AxisAngles), @ZarsBranchkin (ZarsBranchkin), @Oseday (Oseday)', 'image_url': [None], 'created_at': '2015-01-28T03:28:27.000Z', 'last_posted_at': '2015-01-31T02:57:34.000Z'}