hackerpoet / pyspace Goto Github PK
View Code? Open in Web Editor NEWGLSL Fractal Ray Marcher in Python
License: MIT License
GLSL Fractal Ray Marcher in Python
License: MIT License
Here's some work we did with it: https://www.youtube.com/watch?v=5Iv42Ev4fX8
> $ python ray_marcher_demo.py
pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
Compiling Vertex Shader...
b'0:1(10): error: GLSL 3.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, 3.00 ES, 3.10 ES, and 3.20 ES\n'
Traceback (most recent call last):
File "ray_marcher_demo.py", line 253, in <module>
program = shader.compile(camera)
File "/tmp/PySpace/pyspace/shader.py", line 73, in compile
program = self.compile_program(v_shader, f_shader)
File "/tmp/PySpace/pyspace/shader.py", line 102, in compile_program
vertex_shader = self.compile_shader(vertex_source, GL_VERTEX_SHADER)
File "/tmp/PySpace/pyspace/shader.py", line 92, in compile_shader
raise ValueError('Shader compilation failed')
ValueError: Shader compilation failed
Any idea how to fix this?
Thanks a lot!
time_rate = (clock.get_time() / 1000.0) / (1 / max_fps)
ZeroDivisionError: float division by zero
I know python 3 would convert the right term to float but
python 3.9 (on win10) is not loading numpy correctly:
RuntimeError: The current Numpy installation ... fails to pass a sanity check due to a bug in the windows runtime. See this issue for more information: https://tinyurl.com/y3dm3h86
Mouse movement is tied to fps and when frames drop it is unusable. Also i move a lot slower when i am close to fractal
python ray_marcher_demo.py
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
Compiling Vertex Shader...
Compiling Fragment Shader...
b'0(53) : error C1059: non constant expression in initialization\n'
Traceback (most recent call last):
File "ray_marcher_demo.py", line 260, in <module>
program = shader.compile(camera)
File "C:\Games\Downloads\PySpace-master\pyspace\shader.py", line 73, in compile
program = self.compile_program(v_shader, f_shader)
File "C:\Games\Downloads\PySpace-master\pyspace\shader.py", line 106, in compile_program
fragment_shader = self.compile_shader(fragment_source, GL_FRAGMENT_SHADER)
File "C:\Games\Downloads\PySpace-master\pyspace\shader.py", line 92, in compile_shader
raise ValueError('Shader compilation failed')
ValueError: Shader compilation failed
Upon running, I receive the following error message:
Compiling Vertex Shader...
Compiling Fragment Shader...
Fragment shader failed to compile with the following errors:
ERROR: 0:66: error(#132) Syntax error: "=" parse error
ERROR: error(#273) 1 compilation errors. No code generated
Traceback (most recent call last):
File "ray_marcher_demo.py", line 253, in <module>
program = shader.compile(camera)
File "shader.py", line 73, in compile
program = self.compile_program(v_shader, f_shader)
File "shader.py", line 106, in compile_program
fragment_shader = self.compile_shader(fragment_source, GL_FRAGMENT_SHADER)
File "shader.py", line 92, in compile_shader
raise ValueError, 'Shader compilation failed'
ValueError: Shader compilation failed
No idea if i'm doing something wrong here, (still relatively new to coding and GitHub), although I haven't altered the file in any way, and have all the required dependencies, but thought i would bring it up anyway.
I would like to render some of the fractals in more detail (More transformations) how would i do that?
Just a quick question: I noticed there's no way to rotate the camera; I can move my mouse in a circle a bunch of times in order to rotate which direction is up (not sure why this works, but I've seen it happen in some games too,) but there doesn't seem to be a key to do that. I noticed there's a gimbal locked setting in the demo, but no keys bound to rotate. Would this be easy enough to implement?
I'm trying to automate some parameters and I'm having trouble figuring out my issue. I'm getting shader compilation errors when overriding keyvar[3]
with with the converted output of my generator. I'm editing the infinite_spheres
fractal and trying to automate the first parameter in color
:
obj.add(Sphere(0.5, (1.0, 1.0, 1.0), color=('3',0.9,0.5)))
These are the differences in frag_gen.glsl
between working and non working:
*****
frag_gen.glsl
newCol = vec4(vec3(_3,0.9,0.5), de_sphere(p - vec4(vec3(1.0,1.0,1.0), 0), 0.5));
*****
frag_gen.glsl.broken
newCol = vec4(vec3(0.9,0.9,0.5), de_sphere(p - vec4(vec3(1.0,1.0,1.0), 0), 0.5));
*****
As you can see the first argument in vec3()
is _3
but I'm not sure why. This is how I'm overriding keyvars[3]
:
def rangeMap(x, in_min, in_max, out_min, out_max):
return (x-in_min) * (out_max-out_min) / (in_max-in_min) + out_min
sine = float(-1 * math.sin(step) * 2)
keyvars[3] = rangeMap(sine, -2, 2, 0.2, 0.9)
My first thought was some sort of type error but I've tried removing the float
on the sine
variable as well as several other type conversions with no luck. Any ideas?
Thanks for the cool fractals!
You have those 6 numbers in keyvars. How do I create a new fractal? I'm on linux, so I'm thinking some of the keybinds might not work, but I can change the values in keyvars. How do I compile a new fractal, without restarting the program? I saw some cool animations in the video, of fractals changing shape, and I wanted to re-create those. I know this isn't an issue, I just don't know how to comment.
Hello Everyone Im Need Help It Very Important Im Needed To Open But It Not Work
The recording functionality (r key) should produce the rendered frames as images, to ./Playback folder.
The problem is that i'm getting totally black images, even changing fps or resolution or any settings inside "camera.py".
Any guess?
This is some really cool stuff, would love to build on it a bit and try to introduce some optimizations for us poor plebs with lower-end hardware. But just how open source is this? Am I allowed to make some small edits and re-release it publicly? Will I get sued if I make my own "marble marcher" style game based on this code and sell it for money?
Hi,
I would like to know how did you come up with NP functions for each shape. Have you found some article on this topic? Please let me know.
Is it possible to render out just a Z-depth map for compositing in software later?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.