Skip to content
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

Editor: Added REALISTIC shading support for video rendering #28463

Closed

Conversation

ycw
Copy link
Contributor

@ycw ycw commented May 22, 2024

video.rendering.+.realistic.shading.mp4

Preview: https://raw.githack.com/ycw/three.js/editor-render-video-with-realistic-shading/editor/index.html

Demo project: (File>Open) project (1).json

@mrdoob
Copy link
Owner

mrdoob commented May 23, 2024

Hmm, is there a way of not modifying app.js?

@ycw
Copy link
Contributor Author

ycw commented May 23, 2024

extends it instead?

App.Player < App.RenderingPlayer

@mrdoob
Copy link
Owner

mrdoob commented May 23, 2024

That'd be better 👌

@ycw ycw force-pushed the editor-render-video-with-realistic-shading branch from 4881b94 to 5c19ac6 Compare May 23, 2024 07:59
@ycw ycw marked this pull request as draft May 24, 2024 13:44
@ycw ycw marked this pull request as ready for review May 24, 2024 14:55
@ycw ycw force-pushed the editor-render-video-with-realistic-shading branch from 6fc54a7 to ba0eeee Compare May 24, 2024 15:19
@ycw
Copy link
Contributor Author

ycw commented May 24, 2024

extends it instead ?

That'd be better 👌

Player methods were all bound to instance, so RenderingPlayer eventually mixins them instead of extends;

Details:
  • Player exposes renderer,scene,camera,dispatch,events
  • RenderingPlayer overrides render,start,stop
  • RenderingPlayer.render() accepts shadingType and maxSamples;
    • Returns Promise; resolves when a frame completed rendering.
    • shadingType either 'solid' or 'realistic'
    • maxSamples samples for that frame; This param is ignored when shadingType isn't 'realistic'.
Suggestions:
  • Renames app.js to players.js:
editor/
  js/
    libs/
      players.js  # export { AppPlayer, RenderingPlayer }
    Sidebar.Project.App.js   # import { AppPlayer } from './libs/players.js'
    Sidebar.Project.Video.js  # import { RenderingPlayer } from './libs/players.js'

@@ -1,37 +1,40 @@
import { ViewportPathtracer } from '../Viewport.Pathtracer.js';

var APP = {

Player: function () {
Copy link
Owner

@mrdoob mrdoob May 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried doing:

Player: function ( renderer = null ) {

    if ( renderer === null ) renderer = new THREE.WebGLRenderer( { antialias: true } );

}

That way we can do new Player( new PathTracingRenderer() ) and we should be able to keep the current untouched?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe just adding a setRenderer() method to Player?

Copy link
Contributor Author

@ycw ycw May 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean that using single Player to handle both playing app and rendering video? or, Using two players, and make them both accept a custom renderer?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to look for ways to implement this while modifying the current code as less are possible.

Copy link
Contributor Author

@ycw ycw May 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#28517 (Added setPathTracer() to Player)

@Mugen87
Copy link
Collaborator

Mugen87 commented Sep 16, 2024

Closing since the modifications to app.js are too extensive. Let's revisit this issue if there are more demands in realistic shading support for video rendering.

@Mugen87 Mugen87 closed this Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants