-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1052 from t3kt/0.32
0.32
- Loading branch information
Showing
774 changed files
with
5,107 additions
and
3,085 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// @Bigradius {"default":1, "normMin":0, "normMax":2} | ||
// @Coils {"default":1, "normMin":0, "normMax":2} | ||
// @Coilstep {"default":1, "normMin":0, "normMax":2} | ||
|
||
// Coil Symmetry by DjinnKahn | ||
// https://www.shadertoy.com/view/MlK3z3 | ||
|
||
float angleOf( vec2 v ) { return atan( v.y, v.x ); } | ||
|
||
float round_( float x, float m ) { return floor( x/m + .5 ) * m; } | ||
|
||
|
||
// map `pos` to a coiled space | ||
// Think of a thick wire (the coil) wrapped around a torus | ||
// Walking along the wire, | ||
// the returned y-coordinate: distance from the torus | ||
// the returned x-coordinate: left/right deviation from the coil | ||
// the returned z-coordinate: the progress of walking the entire wire (usually ignore this) | ||
// * Lipschitz_continuity is NOT guaranteed * | ||
// - DjinnKahn | ||
vec3 opTorusCoil( vec3 pos, float bigRadius, float numCoils, float coilStep/*try 1.*/ ) | ||
{ | ||
vec3 polarPos = vec3( length( pos.xy ), angleOf( pos.xy ), pos.z ); | ||
vec3 polarC = vec3( bigRadius , polarPos.y , 0. ); | ||
float tiltRelativeToRing = angleOf( ( polarPos - polarC ).xz ); | ||
float distToRing = length( ( polarPos - polarC ).xz ); | ||
|
||
vec3 polarD = vec3( bigRadius, round_(polarPos.y-coilStep*tiltRelativeToRing/numCoils,2.*PI/numCoils) + coilStep*tiltRelativeToRing/numCoils, 0. ); | ||
//float sheetDeltaX = polarC.y - polarD.y; // if you want x-coordinate to be an angle | ||
float sheetDeltaX = polarPos.x * sin( polarC.y - polarD.y ); | ||
float sheetDeltaY = distToRing; | ||
return vec3( sheetDeltaX, sheetDeltaY, fract(polarD.y/(2.*PI)) ); | ||
} | ||
|
||
ReturnT thismap(CoordT p, ContextT ctx) { | ||
float bigRadius = THIS_Bigradius; | ||
float coils = THIS_Coils; | ||
float coilStep = THIS_Coilstep; | ||
p = opTorusCoil(p, bigRadius, coils, coilStep); | ||
return inputOp1(p, ctx); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// @Iterations {"default":7, "normMin":0, "normMax":10, "style":"Int"} | ||
// @Steprotate {"normMin": -90.0, "normMax": 90.0} | ||
// @Scale {"default": 1.0, "normMax": 2.0} | ||
// @Offset {"style": "XYZ", "default": 0.9} | ||
|
||
// Menger Journey by Syntopia | ||
// https://www.shadertoy.com/view/Mdf3z7 | ||
|
||
ReturnT thismap(CoordT p, ContextT ctx) { | ||
int n = int(THIS_Iterations); | ||
float stepRotate = radians(THIS_Steprotate); | ||
float scale = THIS_Scale; | ||
vec3 offset = THIS_Offset; | ||
|
||
p = abs(1.0 - mod(p, 2.0)); | ||
|
||
float d = RAYTK_MAX_DIST; | ||
for (int i = 0; i < n; i++) { | ||
pR(p.xy, stepRotate); | ||
p = abs(p); | ||
if (p.x < p.y) { p.xy = p.yx; } | ||
if (p.x < p.z) { p.xz = p.zx; } | ||
if (p.y < p.z) { p.yz = p.zy; } | ||
p = scale * p - offset * (scale - 1.0); | ||
if (p.z < -0.5 * offset.z * (scale - 1.0)) { p.z += offset.z * (scale - 1.0); } | ||
d = min(d, length(p) * pow(scale, float(-i)-1.0)); | ||
} | ||
d -= 0.001; | ||
|
||
// fudge factor | ||
d *= 0.7; | ||
|
||
ReturnT res; | ||
res = createSdf(d); | ||
return res; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// @Density {"default":0.4, "normMin":0, "normMax":1} | ||
// @Shapemix {"default":0, "normMin": -0.2, "normMax":0.2} | ||
|
||
vec3 erot(vec3 p, vec3 ax, float ro) { | ||
return mix(dot(p, ax)*ax, p, cos(ro))+sin(ro)*cross(ax, p); | ||
} | ||
|
||
//the following functions assume that p is inside the cube of radius 1 centered at the origin | ||
//closest vertex of the cube to p | ||
vec3 vertex(vec3 p) { | ||
return max(sign(p), vec3(0))*2.-1.; | ||
} | ||
//closest face of the cube to p | ||
vec3 face(vec3 p) { | ||
vec3 ap = abs(p); | ||
if (ap.x>=max(ap.z, ap.y)) return vec3(sign(p.x), 0., 0.); | ||
if (ap.y>=max(ap.z, ap.x)) return vec3(0., sign(p.y), 0.); | ||
if (ap.z>=max(ap.x, ap.y)) return vec3(0., 0., sign(p.z)); | ||
return vec3(0); | ||
} | ||
//closest edge of the cube to p | ||
vec3 edge(vec3 p) { | ||
vec3 mask = vec3(1)-abs(face(p)); | ||
vec3 v = vertex(p); | ||
vec3 a = v*mask.zxy, b = v*mask.yzx; | ||
return distance(p, a)<distance(p, b)?a:b; | ||
} | ||
|
||
float hills(vec3 p) { | ||
return sin(2.*dot(sin(p.xy/16.), cos(p.xy/4.)))*3.; | ||
} | ||
|
||
float super(vec3 p) { | ||
return sqrt(length(p*p)); | ||
} | ||
|
||
//rhombic dodecahedron SDF with rounded corners | ||
float rho_dod(vec3 p) | ||
{ | ||
float offset = 0.1; | ||
float radius = .9; | ||
p = sqrt(p*p+offset*offset/2.); | ||
p = (p+p.yzx)-radius; | ||
return super(max(p, 0.))+min(0., max(p.x, max(p.y, p.z)))-offset; | ||
} | ||
|
||
float spheres(vec3 p, out vec3 id, out vec3 loc, float density, float shapeMix) { | ||
vec3 op = p; | ||
id = floor(p)+.5; | ||
vec3 d = face(p-id); | ||
vec3 m = sign(mod(id, 2.)-1.); | ||
if (m.x*m.y*m.z<0.) id += d; | ||
if (id.z + hills(id) > -5.) { //if this ball is absent, get the distance to its neighbour | ||
vec3 e = edge(p-id); | ||
id += e; | ||
} | ||
p -= id; | ||
float rad = 0.7; | ||
float sph = mix(rho_dod(p), length(p)-.7, smoothstep(-.2, .2, shapeMix)); | ||
loc = p; | ||
return max((op.z+3.5+hills(op))/2., sph); | ||
} | ||
|
||
ReturnT thismap(CoordT p, ContextT ctx) { | ||
vec3 id; | ||
vec3 loc; | ||
float density = THIS_Density; | ||
float shapeMix = THIS_Shapemix; | ||
|
||
float d = spheres(p, id, loc, density, shapeMix); | ||
|
||
return createSdf(d); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// @Param1 {"default":1, "normMin":0, "normMax":2} | ||
|
||
// https://github.com/patriciogonzalezvivo/lygia/blob/main/space/triTile.glsl | ||
vec4 triTile(vec2 st) { | ||
st *= mat2(1., -1. / 1.7320508, 0., 2. / 1.7320508); | ||
vec4 f = vec4(st, -st); | ||
vec4 i = floor(f); | ||
f = fract(f); | ||
return dot(f.xy, f.xy) < dot(f.zw, f.zw) | ||
? vec4(f.xy, vec2(2., 1.) * i.xy) | ||
: vec4(f.zw, -(vec2(2., 1.) * i.zw + 1.)); | ||
} | ||
|
||
vec4 triTile(vec2 st, float scale) { return triTile(st * scale); } | ||
|
||
ReturnT thismap(CoordT p, ContextT ctx) { | ||
vec2 q = p.xy; | ||
vec4 tiled = triTile(q); | ||
|
||
p.xy = tiled.xy; | ||
|
||
return inputOp1(p, ctx); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
toolkitVersion: '0.31' | ||
toolkitVersion: '0.32' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
layout: operator | ||
title: sampleAlongLine | ||
parent: Convert Operators | ||
grand_parent: Operators | ||
permalink: /reference/operators/convert/sampleAlongLine | ||
redirect_from: | ||
- /reference/opType/raytk.operators.convert.sampleAlongLine/ | ||
op: | ||
category: convert | ||
detail: It's similar to crossSection but with a single line instead of a 2D plane. | ||
inputs: | ||
- contextTypes: | ||
- Context | ||
- MaterialContext | ||
- CameraContext | ||
- LightContext | ||
- RayContext | ||
- ParticleContext | ||
coordTypes: | ||
- vec2 | ||
- vec3 | ||
label: definition_in | ||
name: definition_in | ||
required: true | ||
returnTypes: | ||
- float | ||
- vec4 | ||
- Sdf | ||
- Ray | ||
- Light | ||
- Particle | ||
name: sampleAlongLine | ||
opType: raytk.operators.convert.sampleAlongLine | ||
parameters: | ||
- label: Center | ||
name: Center | ||
summary: Position in 2D/3D space where the center of the line sits. When a position | ||
of 0 is passed to this operator, it will check its input at the Center location. | ||
- label: Direction | ||
name: Direction | ||
summary: Vector indicating which direction the line goes from the center. | ||
- label: Rotate | ||
name: Rotate | ||
summary: Rotation for the sampling line. | ||
status: beta | ||
summary: Samples a 2D/3D input along a single line, producing a 1D function. | ||
|
||
--- | ||
|
||
|
||
Samples a 2D/3D input along a single line, producing a 1D function. | ||
|
||
It's similar to crossSection but with a single line instead of a 2D plane. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.