-
Notifications
You must be signed in to change notification settings - Fork 31
feat: Post-processing #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like the idea that we can use the other post-processing library directly,
but the overall usage of it looks quite complicated.
To use post-processing, especially when using the three.js
one, the user has to:
- Install
three.js
(even though View3D has a dependency on it) - Import post-processing effects &
EffectComposer
to View3D
While doing this, the user must know all about both three.js
& View3D
Like, for example, in the example of using SSRPass
:
const camera = view3D.camera.threeCamera;
const renderer = view3D.renderer.threeRenderer;
const scene = view3D.scene.root;
const ssr = new SSRPass({renderer, scene, camera, selects: view3D.model.meshes, groundReflector: null});
The user has to know all the internal components of the View3D, which can be hard for newcomers.
I'd prefer simpler usage like this:
// "optionsForSSR" is options for SSR effect itself, like thickness, opacity, etc...
view3D.renderer.addPass(new SSRPass(optionsForSSR));
// Or...
view3D.addPass(new SSRPass(optionsForSSR));
In this case, the user only has to know:
- How to add a post-processing pass in View3D
- Which post-processing effects can be used with View3D
- Options for post-processing effects
Also, it looks a bit hard when we have to add a custom post-processing effect.
Well this is just my thought, I'd like to hear your opinions :)
Thank you for your reply despite your busy :) I agree with your opinion as have to be used more easy for users. 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... |
I thought about that... How about offing 2 ways for users? one is only basic post-processing in 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 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 Summary
Thinking of good balance for usability, scalability, and bundle size, I came to the above conclusion. |
@RudyBlack One concern is, |
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 ) |
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.
|
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. |
I completely agree with that. First, for libraries, it's not easy to change the interface. Secondly, I think it would be difficult to use if you don't provide basic effects at the library level. |
It's kind of you to say that. Thank you very much. |
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 (mrdoob/three.js#14104)
And bundle sizes result. (Before / After)
(Before)
(After)