OpenCL to make a game engines renderer?

Started by
22 comments, last by Krypt0n 12 years, 6 months ago

Interesting Kryt0n, would you be willing to show some screenshots?
I did not take any of the OpenCL version, but it looks the same like the CPU version:

http://twitpic.com/3wozra


Advertisement

[quote name='MARS_999' timestamp='1317424294' post='4867770']
Interesting Kryt0n, would you be willing to show some screenshots?
I did not take any of the OpenCL version, but it looks the same like the CPU version:

http://twitpic.com/3wozra



[/quote]

not bad! At least now I can think about it, for a fun side project...
I do agree that OpenCL is not a smart choice, if what you want to achieve is the same thing you would get out from you OpenGL/DirectX anyway. But as already stated, CUDA/OpenGL raytracers are quite common nowadays (both real time and for off line rendering).
In fact, I think that once next Gen consoles are out, OpenCL/CUDA/DirectCompute will be added to improve engines (most probably through raytraced extensions) just as we slowly moved toward shaders 10 years ago.

Writing an OpenCL raytracer/path tracer or a mixed OpenCL/OpenGL engine would be a truly interesting experience (I'm currently trying to learn OpenCL to rewrite part of my raytracer myself, but I'm fighting against lack of spare time :-(
I wrote a simple OpenCL ray-tracer as my master thesis last year. Even with almost no optimisations at all, I was getting interactive rates on small-mediocre scenes with GF8800/HD4670 cards. I just implemented both BVH and kDtree, both construction (in parallel!) and traversal, no hardcore shading though. This is the way, this will be the future, parallel ray-tracing algorithms :-) Simple, nice and fast in the future.

Nevertheless, the "because I can" factor is too strong, so be it ray-tracing or rasterisation, implementing it is always fun! Just because we can :D And come on, even shitty 5% of current "peak performances" is pretty enough to create nice games on top of such engines!

Have fun!

I wrote a simple OpenCL ray-tracer as my master thesis last year. Even with almost no optimisations at all, I was getting interactive rates on small-mediocre scenes with GF8800/HD4670 cards. I just implemented both BVH and kDtree, both construction (in parallel!) and traversal, no hardcore shading though. This is the way, this will be the future, parallel ray-tracing algorithms :-) Simple, nice and fast in the future.

Nevertheless, the "because I can" factor is too strong, so be it ray-tracing or rasterisation, implementing it is always fun! Just because we can :D And come on, even shitty 5% of current "peak performances" is pretty enough to create nice games on top of such engines!

Have fun!


That is kind of my thoughts... Simple games and what not, maybe worth taking a look at this, vs. relying on a GPU to make the Casual game market... e.g. Facebook crap games or Angry Birds types... Or even simple vector style 3d games?

That is kind of my thoughts... Simple games and what not, maybe worth taking a look at this, vs. relying on a GPU to make the Casual game market... e.g. Facebook crap games or Angry Birds types... Or even simple vector style 3d games?

...because that market usually owns a GPU capable of doing heavy processing like the GTX480. We're still a long, very long time until we reach a playable level on the low-end, consumer-grade integrated GPUs for that kind of rendering.

[quote name='MARS_999' timestamp='1317770412' post='4869138']
That is kind of my thoughts... Simple games and what not, maybe worth taking a look at this, vs. relying on a GPU to make the Casual game market... e.g. Facebook crap games or Angry Birds types... Or even simple vector style 3d games?

...because that market usually owns a GPU capable of doing heavy processing like the GTX480. We're still a long, very long time until we reach a playable level on the low-end, consumer-grade integrated GPUs for that kind of rendering.
[/quote]
but he said it was running fine on a 8800GT, it scores about 11k in 3dmark06, the on-die gpu on AMD Llano scores something between 10k and 11k in 3dmark06 (and is probably more memory limited than a 8800GT). I think it's not that far of until you can start playing with opencl-only games.

I think OpenCL/Cuda rasterization can have quite some advantages, e.g.

-if you rely on gpu rasterization for occlusion culling, you'd have to switch a lot of times between D3D/OGL and Opencl/Cuda and in this case it might be faster to rasterize in a GPGPU language.

-Maybe you're making some quad rasterization, you can either evaluate pixel with openCL or you'd have to tesselate the quad to not suffer from typical triangle borders across a quad.


-you can do proper parabolid rasterization

so, doing it a little bit smarter due to the freedom opencl offers, you can actually be even faster or achive things, than you cannot with the usual rasterizer.




I'm bit of a n00b to CL myself, but don't you have to roll your own boilerplate code, such as texture samplers with filtering? That kind of thing is practically "free" in OpenGL.
Latest project: Sideways Racing on the iPad

I'm bit of a n00b to CL myself, but don't you have to roll your own boilerplate code, such as texture samplers with filtering? That kind of thing is practically "free" in OpenGL.

you have texture units in cuda and opencl with all the possibilities.

the only thing that is missing so far is writing volume textures from compute kernels (although there is a hack from cyril, the gigavoxel guy), but you can't do that from opengl either, just from cpu.


Off the top of my head, these are the things you'd be missing out on when rolling your own GPU rasterizer:

1. Automatic unpacking of vertex attributes, along with any special HW caching that might be involved
2. Post-transform vertex cache
3. The fixed-function tessellation unit
4. Triangle setup
5. HW rasterization and all associated states, such as scissor or clip planes
6. Early z + stencil unit
7. Automatic mip level determination based on fragment UV derivatives (or any access derivatives, for that matter)
8. Fixed function blending
9. Fixed function z + stencil test
10. Any sort of MSAA support

This topic is closed to new replies.

Advertisement