UMLComputerGraphics / GraphicsProject

UML Graphics 2 Final Project 2013
7 stars 1 forks source link

Raytracer needs to understand Object Transformations #87

Closed jnsnow closed 3 years ago

jnsnow commented 11 years ago

I added a uniform that is an array of transformation matrices that is sent to the GPU, but the raytracer doesn't "use them" currently.

The fRaytracer.glsl will need to understand which transformations belong to which triangle.

I am not sure of the best way to implement this; @soujiroboi : please advise?

soujiroboi commented 11 years ago

It may be better to implement this on the CPU side since bounding boxes are created on the CPU side and bound some number of triangles regardless of what objects they belong to.

jnsnow commented 11 years ago

Eric did implement a "CPU-side" version of this, but rebuffering every triangle and recomputing bounding boxes is certainly a lot more work than just sending new transformations over to the GPU.

Bounding boxes can be transformed just as well as anything else; it sounds like we need some way to delineate the triangles buffer to make sure that two objects don't get lumped in together...

nuclearmistake commented 11 years ago

Ish, john... the bounding boxes might contain vertices from multiple objects?

or am i on crack?

On Mon, May 6, 2013 at 10:21 PM, John Snow notifications@github.com wrote:

Eric did implement a "CPU-side" version of this, but rebuffering every triangle and recomputing bounding boxes is certainly a lot more work than just sending new transformations over to the GPU.

Bounding boxes can be transformed just as well as anything else; it sounds like we need some way to delineate the triangles buffer to make sure that two objects don't get lumped in together...

— Reply to this email directly or view it on GitHubhttps://github.com/UMLComputerGraphics/GraphicsProject/issues/87#issuecomment-17519805 .

Eric McCann University of Massachusetts, Lowell Department of Computer Science One University Avenue Olsen Hall, Room 304 Lowell, MA 01854 Lab: 978.934.3385 Email: emccann@cs.uml.edu Homepage (lab): www.cs.uml.edu/robots Homepage: www.emccann.net

jnsnow commented 11 years ago

Yeah, I'd have to adjust that ... Sorry, I wasn't being clear. I think I have to adjust the triangle-buffering phase in a way that a bounding box never spans two discrete objects.

Then apply transformations on the GPU.

At least that way, we'd only have to re-buffer the transformations, but I don't know how much progress I can make on this before the presentation.

soujiroboi commented 11 years ago

The "easy" fix would just be to build the model so that it is in the correct world space. The right way would be to either do it CPU side (I like this option since we should only be doing it once before pushing the buffer) or like you said adjust the triangle buffering phase so that we generate bounding boxes for each object separately, then transforming the bounding boxes that need to be transformed along with the triangles.

nuclearmistake commented 11 years ago

Well, morphing wouldn't work on the raytracer if we just rebuilt the model coordinate system. I think I can parallelize this hard-bad and take the legwork out of the display loop. https://github.com/UMLComputerGraphics/GraphicsProject/issues/89