Pine3D - Best performing 3d graphics libra...
Xella 05 Jun 2016
Pine3D written from scratch
The best performing 3d graphics library for ComputerCraft!
(now 6x faster than the old version from a few years ago)
This post has not yet been properly updated
Please visit https://pine3d.cc/ for documentation and our Discord server discord.gg/MjsNjK2psB for help and more info
gif below is running at 4x default resolution in CCEmuX. It'll run faster in a normal CC resolution. The rewrite will be over 5x faster than the previous version. (also hello if you still look at the forum. It's been a while.)
I'm posting my progress on my small Discord server for this project:
v0.5.1 is released!
Hello everyone! First of all I want to say that English is not my native language, so please don't get angry if I make any mistakes. I have been trying to create a 3D renderer in computercraft. Please give me some feedback and tell me what you would like to see implemented.
Ideas to be implemented:
- Vertical rotation of objects
- Custom vertexshaders
- Texture support (may not be implemented, because it would probably be very laggy to use real-time)
API in action:
http://www.computerc...ine-highscores/
Documentation:
http://www.mediafire...tation.pdf/file
Pastebin downloads:
[ThreeD API minified (smaller file)] - pastebin get meXK8uweThreeD
[ThreeD API (original)I] - pastebin get g1xp8H5X ThreeD
[Engine] - pastebin get DqCTJBza Engine
[First demo] - pastebin get P5b7cAQc Demo1
[Second demo] - pastebin get xTgJQ0hk Demo2
[Third demo] - pastebin get vkaxmF1D Demo3
Complete download (with all files):
http://www.mediafire...ackage.zip/file
Update notes:
Version 0.1:
- Renders 3D objects
- Ability to walk around
- Ability to look left and right
- Give objects rotation values
- Renders 3D boxes
- Ability to walk left and right
- Ability to look up and down
- Ability to fly up and down
- More efficient code
- The code is now split into an API and a demo
- Now uses a buffer (to avoid flickering)
- You can now create your own models
- Square objects look square on screen because the not-square pixels have been compensated for
- The oriƫntation of objects is now changeable
- Objects are not rendered when they're not in sight
- Sky and ground colors are easily changed as background
- Change sorting algorithm to use table.sort() for better performance
- Added support for Bomb Bloke's blittle API - Render distance is changeable
- Using term.blit() to render the screen for better performance
- Cleaner code
- Added support for multiple renders at the same time
- Polygons are now only rendered from one side unless specified otherwise. (For better performance)
- Crash fix
- Lagspike fixes
- Performance is better
- Added the ability to trace what's on the screen at certain coordinates and returns the index of the object with the index of the polygon of the model that corresponds to that object
- Added the ability to manually load models as a tabl
- Added the ability to get the model of an object my model name if it has already been loaded
- Performance is way better
- The polygons can now have a character and char color in case the BLittle function isn't used
- Way cleaner code
- (Documentation added)
- (More demos and comments added to the improved engine)
Edited by Xella, 11 December 2022 - 09:59 PM.
jv110 06 Jun 2016
ReBraLaCC 06 Jun 2016
Xella 07 Jun 2016
jv110, on 06 June 2016 - 04:35 PM, said:
I will absolutely do that. Thank you for the idea. I will have to try a few things because I have never made an API.
ReBraLaCC, on 06 June 2016 - 08:53 PM, said:
I have put the name of the video in my first post. The name is "ComputerCraft - 3D Renderer v0.2 "
Bomb Bloke 08 Jun 2016
apemanzilla 08 Jun 2016
Bomb Bloke, on 08 June 2016 - 01:29 AM, said:
But then it embeds with flash and the only way to access it all with flash disabled is to use the element inspector to get the URL
Edited by apemanzilla, 08 June 2016 - 02:07 AM.
Bomb Bloke 08 Jun 2016
I've also installed an extension to force youtube.com to use the Flash player, as let's face it, their HTML5 player is still a bit rubbish. Once they sort out the overhead and the weirdly increased loading times it might be worth using, but until then, why suffer?
Still, I suppose there's always the option of posting both versions of the link.
Xella 08 Jun 2016
Bomb Bloke 09 Jun 2016
Xella 09 Jun 2016
unnamedcoder 11 Jun 2016
Xella 12 Jun 2016
unnamedcoder, on 11 June 2016 - 05:38 PM, said:
Thank you for your compliment!
I will split my code into an API other people can use and a demo which you can also edit.
I am almost done doing this! (I am having a little trouble debugging, but hopefully it will be finished soon. )
unnamedcoder 12 Jun 2016
Xelostar, on 12 June 2016 - 05:56 AM, said:
I will split my code into an API other people can use and a demo which you can also edit.
I am almost done doing this! (I am having a little trouble debugging, but hopefully it will be finished soon. )
Xella 12 Jun 2016
unnamedcoder, on 12 June 2016 - 08:35 PM, said:
Xelostar, on 12 June 2016 - 05:56 AM, said:
I will split my code into an API other people can use and a demo which you can also edit.
I am almost done doing this! (I am having a little trouble debugging, but hopefully it will be finished soon. )
Well, I was thinking about that myself, but I like working together!
I will probably use some kind of table with relatve coordinates and a few things to draw the lines and stuff. The frame currently looks something like this:
shapeFrame = { coordinates = { {x = -0.5, y = -0.5, z = -0.5}, -- These are the coordinates for one corner {x = -0.5, y = -0.5, z = 0.5}, {x = -0.5, y = 0.5, z = 0.5}, {x = -0.5, y = 0.5, z = 0.5}, {x = 0.5, y = -0.5, z = 0.5}, {x = 0.5, y = -0.5, z = 0.5}, {x = 0.5, y = 0.5, z = 0.5}, {x = 0.5, y = 0.5, z = 0.5}, }, lines = { {1, 5, colors.red}, -- Refer to the index numbers of the coordinates and the color of the line {2, 6, colors.red}, {3, 7, colors.red}, {4, 8, colors.red}, {1, 3, colors.red}, {2, 4, colors.red}, {5, 7, colors.red}, {6, 8, colors.red}, {1, 2, colors.red}, {3, 4, colors.red}, {5, 6, colors.red}, {7, 8, colors.red}, } }
If you can pull such a thing off, I will make my API able to load those kind of models. If you have a better idea of how a model can be saved, please let me know.
Emma 12 Jun 2016
Xelostar, on 12 June 2016 - 09:07 PM, said:
unnamedcoder, on 12 June 2016 - 08:35 PM, said:
Xelostar, on 12 June 2016 - 05:56 AM, said:
I will split my code into an API other people can use and a demo which you can also edit.
I am almost done doing this! (I am having a little trouble debugging, but hopefully it will be finished soon. )
Well, I was thinking about that myself, but I like working together!
I will probably use some kind of table with relatve coordinates and a few things to draw the lines and stuff. The frame currently looks something like this:
shapeFrame = { coordinates = { {x = -0.5, y = -0.5, z = -0.5}, -- These are the coordinates for one corner {x = -0.5, y = -0.5, z = 0.5}, {x = -0.5, y = 0.5, z = 0.5}, {x = -0.5, y = 0.5, z = 0.5}, {x = 0.5, y = -0.5, z = 0.5}, {x = 0.5, y = -0.5, z = 0.5}, {x = 0.5, y = 0.5, z = 0.5}, {x = 0.5, y = 0.5, z = 0.5}, }, lines = { {1, 5, colors.red}, -- Refer to the index numbers of the coordinates and the color of the line {2, 6, colors.red}, {3, 7, colors.red}, {4, 8, colors.red}, {1, 3, colors.red}, {2, 4, colors.red}, {5, 7, colors.red}, {6, 8, colors.red}, {1, 2, colors.red}, {3, 4, colors.red}, {5, 6, colors.red}, {7, 8, colors.red}, } }
If you can pull such a thing off, I will make my API able to load those kind of models. If you have a better idea of how a model can be saved, please let me know.
That's essentially how wavefront objs are, except with faces instead of lines. It is a surprisingly good system.
unnamedcoder 13 Jun 2016
Xelostar, on 12 June 2016 - 09:07 PM, said:
I will probably use some kind of table with relatve coordinates and a few things to draw the lines and stuff. The frame currently looks something like this:
shapeFrame = { coordinates = { {x = -0.5, y = -0.5, z = -0.5}, -- These are the coordinates for one corner {x = -0.5, y = -0.5, z = 0.5}, {x = -0.5, y = 0.5, z = 0.5}, {x = -0.5, y = 0.5, z = 0.5}, {x = 0.5, y = -0.5, z = 0.5}, {x = 0.5, y = -0.5, z = 0.5}, {x = 0.5, y = 0.5, z = 0.5}, {x = 0.5, y = 0.5, z = 0.5}, }, lines = { {1, 5, colors.red}, -- Refer to the index numbers of the coordinates and the color of the line {2, 6, colors.red}, {3, 7, colors.red}, {4, 8, colors.red}, {1, 3, colors.red}, {2, 4, colors.red}, {5, 7, colors.red}, {6, 8, colors.red}, {1, 2, colors.red}, {3, 4, colors.red}, {5, 6, colors.red}, {7, 8, colors.red}, } }
If you can pull such a thing off, I will make my API able to load those kind of models. If you have a better idea of how a model can be saved, please let me know.
I'll have a go at making a program that allows you to edit and create objects, if you wanna work by yourself, I'll leave you to it
EDIT: could you possibly provide a 2d linedrawing api for me?
Edited by unnamedcoder, 13 June 2016 - 03:16 PM.
Emma 13 Jun 2016
unnamedcoder, on 13 June 2016 - 02:56 PM, said:
could you possibly provide a 2d linedrawing api for me?
Just use paintutils.drawLine
Xella 13 Jun 2016
If you want to have a 2d line drawing API, you could just use:
paintutils.drawLine(x1, y1, x2, y2, color)But I assume you want something like this:
for lineNr, lineCoordinates in pairs(linesToDraw) do paintutils.drawLine(lineCoordinates.x, lineCoordinates.y, lineCoordinates.x2, lineCoordinates.y2, lineColor) endAnyway, please let me know when you are getting somewhere!
Edited by Xelostar, 13 June 2016 - 04:01 PM.
unnamedcoder 14 Jun 2016
Xelostar, on 13 June 2016 - 03:55 PM, said:
If you want to have a 2d line drawing API, you could just use:
paintutils.drawLine(x1, y1, x2, y2, color)But I assume you want something like this:
for lineNr, lineCoordinates in pairs(linesToDraw) do paintutils.drawLine(lineCoordinates.x, lineCoordinates.y, lineCoordinates.x2, lineCoordinates.y2, lineColor) endAnyway, please let me know when you are getting somewhere!
Well, at the moment I'm trying to figure out a way to do this, I was thinking that it could be done with layers, the arrow keys will decide which layer you are editing therefore you could create full block shapes, another idea was placing points to connect lines to, I'm still trying to wrap my head around the concept.
Xella 14 Jun 2016
I advise you to wait until I release my API. Then you can use it to draw what people are creating.
Well, it still is hard to create a program for creating models...
Maybe you can make it so that the user can click somewhere on the screen (2d) and then give a height value to that point. Later the user can connect these points to draw lines. I wish you a lot of succes!