erichlof / THREE.js-PathTracing-Renderer

Real-time PathTracing with global illumination and progressive rendering, all on top of the Three.js WebGL framework. Click here for Live Demo: https://erichlof.github.io/THREE.js-PathTracing-Renderer/Geometry_Showcase.html
Creative Commons Zero v1.0 Universal
1.93k stars 177 forks source link

Works on iOS? #8

Open fabiodr opened 6 years ago

fabiodr commented 6 years ago

Tried on iOS 11, iPad 2017, but it’s all black, maybe some minor issue in shaders?

https://erichlof.github.io/THREE.js-PathTracing-Renderer/Geometry_Showcase.html

77f42d77-e5e1-4f3a-992c-a0250e3141cb

erichlof commented 6 years ago

@fabiodr Hi, I'm afraid for mobile devices, it only works on Google Chrome browser for Android at the moment. Also I only own a Samsung phone so that's what I've been able to test it on for my projects. I know some people who have iPhones but I would need to have one on hand to debug an application. Yes, like you mentioned, it probably is an issue with the shaders. Some of the shader source (1000 lines) for the demos are at the limits of compiling successfully on older machines. I would have to start from scratch, make an all red screen (most simple Hello World shader) and slowly build up line by line to see where a compilation problem occurred on iOS. Unfortunately GPU shader programming does not have a lot of debugging tools like one has in other environments.

Sorry it's not working for you. Thank you for the message and heads up. -Erich

fabiodr commented 6 years ago

Indeed, GLSL can become tricky for many browser/gpu configurations, maybe a service for JS error tracking (Sentry, Rollbar...) can help to understand where it’s running or not, they have a free tier.

Thanks for the attention :)

Obs: just saw a very interesting technique for realtime illumination, it’s in Processing (Java) but the creator said it’s based on OpenGL ES 3.0, so it may be possible with acceptable performance in WebGL 2.0 http://thomasdiewald.com/blog/?p=2949 http://thomasdiewald.com/blog/?p=3159

erichlof commented 6 years ago

@fabiodr Thanks for the Sentry and Rollbar error tracking tip, I will check those out. Also I think Firefox had some sort of GLSL inspector that shows all of the execution steps on the GPU so you can kind of see what's being called. I think originally it was intended to profile for optimizations because there could be too many draw calls at times when you weren't expecting them. But maybe that can help. I think Chrome has a browser extension also nowadays.

Wow that 2d radiosity Java app is beautiful! I must admit I don't know quite how he is doing that via the rasterizer as he mentioned in his blog post. I would guess he does some kind of shadowmap depth projection, then saving the ray cast bounce info in a huge light map texture, then sampling from that on a pixel by pixel basis. I'll try to check out his source, although I don't think he has that particular project public on his github repos: Recent Source request It seems like magic though - it has given me some ideas for future scenes in my project!

Thanks again, -Erich

RenderTool commented 4 years ago

@fabiodr iPhone only supports HalfFloatType(even iPhone11pro) . You can try to replace THREE.FloatType in pathTracingRenderTarget(commandFunctions.js) and screenTextureRenderTargett(commandFunctions.js) with THREE.HalfFloatType. @fabiodr 因为目前市面上的苹果手机只支持半浮点运算。(甚至是苹果11pro),你可以试着把全浮点改成半浮点。希望对你有用。

erichlof commented 4 years ago

@q750831855 Thank you for the tip! Some of my family members have iPhones, so I will give this a try on their devices. Thanks again! -Erich

vinkovsky commented 3 years ago

I also think the problem is safari doesn't support webgl2 by default. It must be enabled in preferences, at least on Mac it works like this