Search code examples
htmlraytracingprocessing.js

which rendering way should I use in a web based project


I have a database of 3D models. I want user can rotate the model and view it in the web page. So I have to implement an instant rendering algorithm for this.

A raytracing/raycasting method on CPU is preferred since the server has no GPU on it.

I understand that a primary-ray-only ray tracer with SSE and KD-Tree/BVH can be very fast. Besides, I want to add some GI effect(fake GI effect can be also OK for me, such as SSAO) in it.

How good can I achieve?

(some NPR rendering methods are also considerable)


Solution

  • In HTML5, you can render 3D objects with WebGL (an implementation of OpenGL) with some JavaScript. The problem is that WebGL is a client technology. Therefore, all the rendering is done by the browser.

    There is one possible solution if you really want to distribute some logic on a server. You could use a server side language and send the vertices to the client through some database transactions. After, your website could make some AJAX calls to a server that would make certain operations within the server and return some vertices. The only problem is that this could require a lot of bandwidth.

    Otherwise, another solution would be to use a tool such as Unity to create what you want. Then, you would need to embed the Unity Player in your web page.