Open RudyBlack opened 1 year ago
Thank you for your reply despite your busy :)
I agree with your opinion as have to be used more easy for users. Looking back, It seems customizable for post-processing but is hard to use.
I will more think about the between Performance (by low bundle size), Easy to use and Customizable although It is hard to achieve all of them perfectly.
So I will get find the best balance through various experiments in work such as It is easy to use, It is customizable for effects, bundle size has not been stretched too big, etc...
@WoodNeck
I thought about that...
How about offing 2 ways for users? one is only basic post-processing in View3D
and the other offers customizable post-processing API.
First way is like this as you said:
import View3D, { SSRPass, BloomPass, DoFPass } from "View3D";
view3D.addPass(new SSRPass(optionsForSSR), new DoFPass(optionsForDoF), new BloomPass(optionsForBloom));
In this case of important is, Users do not need to install THREE.JS
. because of offered basic post-processing in View3D
, Users be easily use post-processing.
Also, the bundle size will not get bigger because only basic post-processing is provided.
The second way is like this:
import { EffectComposer, SSRPass } from "three/~~"
or
import { EffectComposer } from "post-processing"
view3d.setEffectComposer(new EffectComposer());
view3d.setPass(({renderer, camera, scene, effectComposer, model, ...})=>{
// This callback function is offered params that need to make for post-processing or custom post-processing.
// So users can customize even not know inside view3D.
const ssr = new SSRPass({renderer, scene, camera, selects: model.meshes, groundReflector: null});
const customEffect = new ???(...);
effectComposer.addPass(ssr, customEffect);
})
In this case, Users have to install THREE.JS
or post-processing
library.
Summary
post-processing
library or custom post-processing. But in this case, Users have to install THREE.JS
or library
.Thinking of good balance for usability, scalability, and bundle size, I came to the above conclusion. Is there anything I missed or do you have a better idea? If not, I will work on that :)
@RudyBlack That looks promising, you can keep up with that!
One concern is, model
can be changed at any time, so the post-processing pass won't work on the new model load.
So, please add something that can refresh the selects
field of the effect for the second approach.
@WoodNeck
I found some issues while I was working.
Post-processing that built-in ThreeJS is not working or something issue on using each other. For example, can't use SSR and SSAO together. and have to apply tone mapping but If using bloom together, is to appear issue. and DoF has to be the last pass index. and etc... I am worried that offering basic post-processing to users is given to confusion.
So how about just providing only an interface that can use post-processing? ( Not provide basic post-processing ) or do you have some idea?
@RudyBlack
If it's not available, I think it would be helpful enough to establish an interface for using post-processing as you say. Specifically, I don't think you need to feel like you need to support all effects at this point. However, for the issues you mentioned, it would be good to check these things out.
@WoodNeck
Why don't you try implementing some simple post-processing effects of your own that aren't provided by three.js, that might help us get a better idea of what's causing the issues you're describing.
I have a plan to implement simple post-processing effects myself. But it looks need knowledge of custom shader, glsl, math, etc. (I am studying hard for this...) and I think it will take a long time. so It's better to go step-by-step rather than implement it all at once. I'm sorry for the confusion.
Therefore, I will only make an interface to use post-processing and then implement the basic effects in the future.
@RudyBlack
It's better to go step-by-step rather than implement it all at once.
I completely agree with that. Just, I would like you to check two things.
First, for libraries, it's not easy to change the interface. View3D follows Semantic Versioning, so any interface changes that might affect users would require a major version update, which we try to avoid if possible. So you have to be very careful when writing the interface. I like your approach, so go ahead and try it out, I'll keep reviewing it.
Secondly, I think it would be difficult to use if you don't provide basic effects at the library level. It will be difficult for users to configure their own effects, because they will have the same issues you are having now. So if possible, it would be great if you could include at least the ones that are working now, so that I can check them out and fix the ones that aren't :)
@WoodNeck
It's kind of you to say that. Thank you very much. It was a little hard at the same time as the company work, but I'll try as much as I can and ask for help if it really doesn't work. So I'll keep going :)
Keep up the great work!
Details
There are two main ways to apply postprocessing.
First way is using Post-processing of built-in three.js. Second way is using Post-processing of library
Since each has its pros and cons, I decided it would be better for the user's can be choose one of two theyself. (Of course, can't be use mixed it.)
But have a background issue (https://github.com/mrdoob/three.js/issues/14104)
And bundle sizes result. (Before / After) (Before) (After)