-
Notifications
You must be signed in to change notification settings - Fork 73
Request: Control perspective and lighting from the program #73
Comments
I like your proposal. @sebastien has asked for a related feature. I don't want to put view parameters inside of a shape. As you say, they don't belong there, and it begs the question of whether the view parameters are preserved by transformations, and what happens if you union two shapes with different view parameters. Instead, I am thinking of adding a new kind of graphical value, "view" values, which are peers to shape values. So, how about,
It should be possible to make a parametric view (with sliders for view parameters), and a parametric view should also display value pickers for the shape, if the shape is parametric. |
So here are my two cents: in Curved, I have a In general, and also in relation to #74, I think it would be ideal to have a way to override the fragment shader part with a custom curv function taking I'm still in the early stages of integrating interactive parameter space exploration and preset saving, but it's pretty clear to me that you might want to save multiple presets for one Curv sketch, as the more parametric values you have, the more interesting configuration you might find. The proposed |
At this point, all of the command line options for configuring the viewer window can now be specified using Curv code in the configuration file
Based on discussion here, in issue #74, and in PR #75, here are some things I could do next:
For example,
|
This is great! Will it be possible at some point to use curv directly to define a |
@sebastien I think that defining a renderer in Curv will require extensions to the compiler to generate more appropriate GLSL code. It makes sense to do this work first. Consider it a stepping stone. |
I added an optional
The reason for putting this into the Shape record (as opposed to defining a new Scene type) is so that you can add rendering parameters to a public Shape project, without breaking other projects that might might be referencing it. Just think of the My perspective is that Curv source files (*.curv) can be edited using an ordinary text editor and shared across the internet. At some point, I'll add a feature for referencing Curv source files and packages using URLs, instead of just local file system paths. The two common use cases are: a Curv source file defines a shape, or it defines a library. If a Curv source file defines a shape, then you'd like to be able to add rendering parameters without changing the type and breaking existing clients. I acknowledge that the Curved project has a different design, and I'll have to discuss this with @sebastien. The code I just committed is not intended to be the final design. This is a work in progress. Next steps:
|
There is a new render parameter called This parameter is just a temporary kludge to enable experimentation with @p-e-w's code, while I figure out an improved design. |
You can now set the
Here's an example that I tested. This lighting function is the same as the default lighting function, except that I removed ambient occlusion (which makes very little difference anyway, based on the models that I tested).
|
Nice, that's one more step in the direction of having shadertoy-like functionality! |
Camera control needs to be a separate issue: #56. Lighting control needs to be part of a larger issue, which is a new PBR (physically based rendering) system. PBR is a very complex topic, so I want existing open source code that, as much as possible, can simply be plugged in to Curv. I don't want to reinvent PBR from first principles. Eg, we could clone the Eevee renderer used by Blender 2.80. The Eevee code supports the sophisticated rendering that people want, it's open source, it renders in real time, it uses OpenGL 3.3 (same as Curv), and the algorithm appears to be compatible with Curv's signed-distance-field representation. Blender has designed a set of PBR parameters which they call "Principled BSDF", which is compatible with Renderman and Unreal Engine. https://docs.blender.org/manual/en/latest/render/shader_nodes/shader/principled.html |
When rendering a Curv program, the viewer currently displays the shape using what looks like a standard perspective projection, slightly rotated, with a single white point light source located somewhere behind the camera.
I'd like to be able to control all of these aspects from the program itself. View parameters aren't strictly speaking properties of the shape, so it probably makes sense to group all of them in a
view
field.Rough sketch of how this could look:
The text was updated successfully, but these errors were encountered: