Jump to content
  • Advertisement
Sign in to follow this  
polar01

using GLSL in a Raytrace software

This topic is 3173 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I currently use GLSL to do some 'shading' operation into an editor. Behind this, I have write a 'rendering/raytrace' application but I would like to define 1 time the shader. All the shaders are GLSL, so do you think that I can use GLSL to compute the shading of my points into my raytracer ? If yes, how can I acheive this ? Thanks for your help

Share this post


Link to post
Share on other sites
Advertisement
Hi,

I don't really understand what you have. Did you implement the raytracer on the CPU? Are you already using shaders together with your raytracing app?

Rosália

Share this post


Link to post
Share on other sites
Okay,

I explain :-)

I have a raytracer writen in pure Java but I would like to use GLSL.

So I must be able to :
1 - Transfer some information to my shader (which one ???)
2 - Call a GLSL shader from Java/c++/...
3- Get the result back to my Java application

I don't know :
1 - if it is possible ?
2 - how to do this ?

Thanks

Share this post


Link to post
Share on other sites
Thanks,

I don't need a tutorial about Shaders or GLSL, I already use them in my application.

By example, I need some way to get back the result of the shader, I have try with a glGetFloat(Frag...) but i does'nt work !

I just need to know how I can initialize the shader, call it, and get back the result.

I already have some code... but it doesn't work :-(

Share this post


Link to post
Share on other sites
It is possible, but it is not easy (ever wondered why there are no debuggers for shaders?), and I don't really think it is the way to go for performance.

If you *must* make your raytracer faster, I'd suggest something else like kd-trees, or transferring it entirely to the GPU (I've heard of it, never did it myself, so I can't tell you how well it works)

Good luck!

Share this post


Link to post
Share on other sites
Quote:
Original post by viewon01
By example, I need some way to get back the result of the shader, I have try with a glGetFloat(Frag...) but i does'nt work !

I just need to know how I can initialize the shader, call it, and get back the result.
You need to render into a render-buffer attached to an FBO, then copy that render-buffer into a pixel-buffer-object, and read it back into main memory.

You can do a similar trick with texture+FBO, but I believe the pixel-buffer-object should be the performance path on most hardware.

Share this post


Link to post
Share on other sites
Just an idea, maybe you could use OpenCL (CL, not GL)

A raytracer must be ultrafast, maybe using Java is not a good idea.

Share this post


Link to post
Share on other sites
I'm no opengl wiz, but I would guess you use glReadBuffer / glReadPixels or something like that to read back data from an FBO. I think whatever performance gain you get by distributing parts of your raytracer to shaders will be rather nullified by reading back data from the GPU though. It's kinda time consuming.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!