Comments (3)
This is definitely possible.
I've been trying to avoid it, since the shader code gets a bit confusing, and people actually would have to write glsl code.
I did some experiments with a map implementation, which was pretty much implemented like this...
Haven't published it yet though, because I didn't really have a good use case, yet (and it was very restrictive on older hardware).
If you have something cool, I definitely would like to see it ;)
I had a few plans to make this nicer, but nowadays, I rather put my hope into SPIR-V, which would allow to write shaders completely in julia :)
JuliaLang/julia#11516
Will take quite some time to get there, though...
But it's defenitely the nicest way!
from glvisualize.jl.
I agree that keeping glsl code away from the user is a good thing. I've seen some WebGL strategies where they have a lot of basic shaders already written and then use a parser to stitch them together for a specific purpose. Maybe something similar to this would work in Julia, where shaders are selected based on the operations being applied to what is rendered, and then stitched together? I'll take a look into it and let you know if I have something working.
Great job on the next2 branch by the way. It is going to be incredibly useful
from glvisualize.jl.
Thanks :)
I was thinking to create something like that for the near future:
immutable Material{ShaderType, ColorType, ReflectanceType}
color::ColorType
reflectance::ReflectanceType
end
immutable Instances{PositionType, ScaleType, RotationType}
position::PositionType
scale::ScaleType
rotation::RotationType
end
function call(m::Material{Phong}, backend::OpenGL)
"""
in $(to_gltype(m.color)) color;
in $(to_gltype(m.reflectance)) reflectance;
vec3 phong_lighting(...){
...
}
"""
end
function call(instance::Instance, backend::OpenGL)
"""
in $(to_gltype(instance.position)) position;
in $(to_gltype(instance.scale)) scale;
in $(to_gltype(instance.rotation)) rotation;
vec3 do_position_transform(...){
...
}
"""
end
function visualize{Inst,Mat}(instance::Inst, material::Mat, backend)
vertex_kernel = Inst(backend)
fragmen_kernel = Mat(backend)
compile(vertex_kernel, fragmen_kernel)
end
This is obviously not really thought out yet, but it would nicely scale with Vulkan and offer the user the possibility to overwrite and customize the whole pipeline right away! It would also make it easier to create shaders for different OpenGL and WebGL versions...
from glvisualize.jl.
Related Issues (20)
- How to use rotations?
- Make deleting an object easier by returning the output of extract_renderable from _view HOT 3
- 1) Orthographic camera example, 2) Default camera too close, and 3) Custom camera disrupts zooming and rotation HOT 7
- Scoping error with `filter` function in camera.jl when running GLPlot HOT 7
- cubecamera error HOT 8
- line_segment.vert will not link HOT 8
- Google Summer of Code 2018
- The glvisualize.com web site is gone (domain expired) HOT 4
- Color of an object changing in time HOT 3
- FFmpeg-converted video not showing properly in some of the standard players HOT 2
- Test failed on volume.jl, warnings in build HOT 4
- Doc examples out of date?
- Dynamically adjust the number of rendered objects HOT 6
- test errors on MacOS HOT 5
- ERROR: GLVisualize test HOT 2
- Julia 0.7 / 1.0 HOT 9
- ERROR: Unsatisfiable requirements detected for package GLVisualiz HOT 1
- Info about upcoming removal of packages in the General registry
- Unsatisfiable requirements with julia 1.2.0 on Ubuntu 18.04 HOT 1
- More volume rendering algorithms HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from glvisualize.jl.