Love3D

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
substitute541
Party member
Posts: 484
Joined: Fri Aug 24, 2012 9:04 am
Location: Southern Leyte, Visayas, Philippines
Contact:

Re: Love3D

Post by substitute541 »

A Quick Note on backface culling, since your making polyhedrons. Backface culling checks if the order of the points are made clockwise, if true, it will not cull, if false however, it will cull(hide, in this case, skip) the counter/anti-clockwise triangle. Oh and, since it requires 3 points, only triangles are able to have lighting, that is normal however, since, rendering in a 3D graphics program simplifies every poly to a triangle.
Currently designing themes for WordPress.

Sometimes lurks around the forum.
User avatar
Ref
Party member
Posts: 702
Joined: Wed May 02, 2012 11:05 pm

Re: Love3D

Post by Ref »

Codex wrote:400 FPS on my laptop!
:3
As expected, fps very dependent on number of facets since everything is being done on the CPU (not the GPU).
Typical objects have a lot more facets than my simple demo (24 versus 314 for the standard teapot ).
Present demo seems to do OK on everything except the original cube??
Edit: <Demo removed>
Last edited by Ref on Thu Nov 08, 2012 7:23 pm, edited 1 time in total.
User avatar
substitute541
Party member
Posts: 484
Joined: Fri Aug 24, 2012 9:04 am
Location: Southern Leyte, Visayas, Philippines
Contact:

Re: Love3D

Post by substitute541 »

Ref wrote:
Codex wrote:400 FPS on my laptop!
:3
As expected, fps very dependent on number of facets since everything is being done on the CPU (not the GPU).
Typical objects have a lot more facets than my simple demo (24 versus 314 for the standard teapot ).
Present demo seems to do OK on everything except the original cube??
I do hope you noticed that you actually made the lighting worse. Have you ever tried the original test7 (aka, Backface Culling Demo) in the Love2D Wiki Page (called Love3D, derp) ? Those that are not facing the light source are being lit. Did you ever noticed that? P.S. , did you try to use Backface Culling? It will solve the "original cube" problem.
Currently designing themes for WordPress.

Sometimes lurks around the forum.
User avatar
substitute541
Party member
Posts: 484
Joined: Fri Aug 24, 2012 9:04 am
Location: Southern Leyte, Visayas, Philippines
Contact:

Re: Love3D

Post by substitute541 »

And, re-building the Love3D Library. This time, 3D quads are removed, and triangles now have their own class...
Currently designing themes for WordPress.

Sometimes lurks around the forum.
User avatar
substitute541
Party member
Posts: 484
Joined: Fri Aug 24, 2012 9:04 am
Location: Southern Leyte, Visayas, Philippines
Contact:

Re: Love3D

Post by substitute541 »

Made the lib, gonna post it here since, I'm wondering if anyone care to test it. I removed Light3D and Preset3D for a moment, until I got it working with the new Triangle3D Class.

Love3D R1 Version 0.4.0

P.S. : R1 means Revised 1
Currently designing themes for WordPress.

Sometimes lurks around the forum.
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Love3D

Post by Roland_Yonaba »

substitute541 wrote:Made the lib, gonna post it here since, I'm wondering if anyone care to test it. I removed Light3D and Preset3D for a moment, until I got it working with the new Triangle3D Class.

Love3D R1 Version 0.4.0

P.S. : R1 means Revised 1
Hi Substitute.
Good work on that. By the way, why not host this on Github or Bitbucket ? It would be easier for you to monitor your changes between different versions, and for people to provide feedback and relevant changes to optimize.
Just a suggestion.
User avatar
Ref
Party member
Posts: 702
Joined: Wed May 02, 2012 11:05 pm

Re: Love3D

Post by Ref »

substitute541 wrote:
I do hope you noticed that you actually made the lighting worse. Have you ever tried the original test7 (aka, Backface Culling Demo) in the Love2D Wiki Page (called Love3D, derp) ? Those that are not facing the light source are being lit. Did you ever noticed that? P.S. , did you try to use Backface Culling? It will solve the "original cube" problem.
Glad to see your renewed interest as at least someone knows what their doing.
Look forward to your enhansed library.
Best

Edit: Curious that you feel that things got screwed up as all I did was reverse the normals so that I could use objects that follow the right_hand rule. Not quite true. Also changed light.b calculated using light.ab rather than light.ag (just didn't look pretty).
In the future, I will rename my bastardized version of your library so that there will not be any confusion with the real Love3D.lua version.
Edit: Might want to change love3D.isBackFace() to return cax * bcy >= cay * bcx. Without the '=' the triangle (0.0),(1,1),(1,-1) would be culled no matter what order the verticies are in (Did I do the math correctly?).
Edit: Color distortion was because I had set the ambient color to a wierd value. Now, everything appears much better.
User avatar
substitute541
Party member
Posts: 484
Joined: Fri Aug 24, 2012 9:04 am
Location: Southern Leyte, Visayas, Philippines
Contact:

Re: Love3D

Post by substitute541 »

Roland_Yonaba wrote:
substitute541 wrote:Made the lib, gonna post it here since, I'm wondering if anyone care to test it. I removed Light3D and Preset3D for a moment, until I got it working with the new Triangle3D Class.

Love3D R1 Version 0.4.0

P.S. : R1 means Revised 1
Hi Substitute.
Good work on that. By the way, why not host this on Github or Bitbucket ? It would be easier for you to monitor your changes between different versions, and for people to provide feedback and relevant changes to optimize.
Just a suggestion.
You can look at the status of my lib here.

EDIT : Gonna work on my BitBucket account :P
Currently designing themes for WordPress.

Sometimes lurks around the forum.
User avatar
Ref
Party member
Posts: 702
Joined: Wed May 02, 2012 11:05 pm

Re: Love3D

Post by Ref »

Have made further changes to substitute541's Love3D so have decided to rename my mutilated version to RefD3 so that no one else will fall into the trap of confusing the various versions of Love3D and will be able to find the latest & best version of the real Love3D. (Well delete previous demos to avoid confusion.)
Substitute541 original license is still present. (Not too sure what all this licensing is about when you take functions from someone elses book and not give credit to the author in the code – sort of like copy-writing a translation of a book under a new name without the author’s permission or credit. The basic functions can be found in Jasoco's work. As long as I'm not precluded from using the code, I don't mind. I guess it has to do with ego or something?). Have to say the the biggest advantage of substitute541's code is that he used very descriptive function names (Yes kikito, someone actually does!) as compared to Jasoco's uncommented code.
What I've done is stripped out all the stuff I don't need and replaced x,y,z indexing with [1],[2],[3] and ipairs with for loops. Got ~10% increase in speed.
Have add ability to read geometry from a data file (using Jasoco's format). Geometry can now be read in form CAD files (like the free openscad) without reversing the handedness (right-hand rule now followed).
Limitations:
1. custom file format (points & poly) though geometry can be inserted directly or a simple STL translation used.
2. images are highly faceted because facet normals are used – not point normals (but since we don't currently have point blending – that's what were stuck with.)
3. Squares created from multiple triangles are not uniformly colored because lighting uses surface normals and z value. When image rotates, triangles have different z's and even though their normals have the same orientations, they are rendered differently. Weird effect.
4. Until the God's of Love enable more access to openGL, texturing is a problem. Of course, more openGL == more complexity. Remember, in Love, complexity ~= fun – KISS!
5. Status:
Suitable for adding simple 3D geometry to scripts.
Really need ability to transfer tables from a thread so points can be rotate in the background while the image is being displayed.

Demo attached. Wasd active and mouse moves light source.
Probably should stay out of substiture541's hair and let him run with this.
Attachments
Ref3D.love
Just exploring potential.
(213.77 KiB) Downloaded 139 times
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Love3D

Post by Nixola »

Could you do something that renders more than one polygon at once? :awesome:

By the way, I liked how I got 160 FPS with the teapot on my dad's PC, that doesn't even play 720p Youtube videos smoothly
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Post Reply

Who is online

Users browsing this forum: dusoft and 4 guests