Calculating where the shadow falls on a plane

This program allows to see if 3d vehicles respect a certain standard or not. This is why I need to image my floor like a matrix based on tiles and know with precision which of them are hard and soft shadowed.

[quote=“Dark_Photon”]

I have to confess. I don’t understand:

  1. [li] why you think you need CUDA for this,[*] why you’re convinced you need a renderbuffer over a texture.
  • Because I thought it could be much faster keeping all data on graphic card and merge all the shadow-set from there, without reading everytime the RBO/Texture to a buffer and sending it everytime back the to the cpu.
  • Because reading around, they say RBO are faster (like here )

However, I would like to underline that this is just my impressions and since I am a newbie in OpenGL I am totally open to suggests/ideas

Ok, but would this require to use OpenGL 3+? Because I was told to start with OpenGL 2 since it is easier for beginners. Do you think GL/GLSL and OpenGL 3 is too much? I am also asking, because it looked to me like the most of tutorials on the web are for the 80% based on the OpenGL 2 and 1.

Actually I was trying to render a 5 milions of triangles, but I had some problem with the VBO allocation (I could not create a single VBO with more than 2M), so at the end I just allocate 3 VBOs and render them sequentially. It was quite slow, but could be depend on the crap 9400 GT that I am using?

Btw this could depend on java and 32-bit system. I am going to check on a 64b windows in the next future.

Thanks for the link, I am going to see it later

Ok.

Almost certainly! However, AFAICT you can do this all in OpenGL on the GPU, without any readback to the CPU, without any CUDA or OpenCL.

  • Because reading around, they say RBO are faster (like here )

Perhaps a little in some circumstances, depending on vendor/format/driver version idiosyncrasies, but that’s not a given.

However, it’s trivial to switch rendering from renderbuffer to texture or vice versa. You just use the texture if you need to read the data back into GL later. Use renderbuffer if you don’t. And even then, if you’re hard set on rendering to renderbuffer, you can use glCopyTexImage2D to copy from RB into texture after rendering. You have options.

Given what I think you’re trying to do, it seems that using CUDA or OpenCL is probably overkill (definitely so if you’ve never coded in CUDA or OpenCL).

You could use OpenGL with GLSL shaders for this (which is OpenGL 2.x not 3.x), and that would give you the most flexibility and probably ultimately be simplest (it’s not that hard). Though I think you might even be able to do what you want without shaders if you’re determined, since you can build shadow maps and render with them without shaders, and possibly use additive blending to merge your shadow counts together.

Yep, but the tricky part is to find the best implementation :smiley:

Here the comfortable part comes :p, I spent over one year on Cuda, developing a custom program that speed up Zero-Knowledge proof that require thousand of multiplications between large numbers. And based on what I looked around, OpenCL is pretty similar… So this should not be a problem.
Indeed, actually I do already use Cuda to calculate the coordinates of the projected triangles on the floor (that is the shadow) of my 3d model.
What scares me, is OpenGL 3/4, shader and GLSL… material on these topics lack over the net :stuck_out_tongue: