Skip to content

Commit

Permalink
Merge pull request #1052 from t3kt/0.32
Browse files Browse the repository at this point in the history
0.32
  • Loading branch information
t3kt authored Apr 4, 2023
2 parents 974fe6c + 3ccc43d commit 554198c
Show file tree
Hide file tree
Showing 774 changed files with 5,107 additions and 3,085 deletions.
Binary file added devel/prototypes/chamferRectangle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added devel/prototypes/chamferRectangle.tox
Binary file not shown.
41 changes: 41 additions & 0 deletions devel/prototypes/coilTransform.glsl
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);
}
Binary file added devel/prototypes/coilTransform.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added devel/prototypes/coilTransform.tox
Binary file not shown.
Binary file added devel/prototypes/hexRepeat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added devel/prototypes/hexRepeat.tox
Binary file not shown.
Binary file modified devel/prototypes/linearRepeat.tox
Binary file not shown.
36 changes: 36 additions & 0 deletions devel/prototypes/mengerJourney.glsl
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;
}
Binary file added devel/prototypes/mengerJourney.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added devel/prototypes/mengerJourney.tox
Binary file not shown.
Binary file added devel/prototypes/moduloPolarBlend.tox
Binary file not shown.
73 changes: 73 additions & 0 deletions devel/prototypes/packedSpheresBlackle.glsl
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);
}
Binary file added devel/prototypes/packedSpheresBlackle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added devel/prototypes/packedSpheresBlackle.tox
Binary file not shown.
Binary file added devel/prototypes/pistonRepetitionFix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added devel/prototypes/pistonRepetitionFix.tox
Binary file not shown.
23 changes: 23 additions & 0 deletions devel/prototypes/triTile.glsl
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);
}
Binary file added devel/prototypes/triTile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added devel/prototypes/triTile.tox
Binary file not shown.
4 changes: 1 addition & 3 deletions devel/toolkitEditor/ropEditor/specPanel/specPanel.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from raytkUtil import ROPInfo
from raytkModel import ROPSpec
from raytkTools import RaytkTools
from typing import Optional
import yaml
Expand All @@ -25,7 +23,7 @@ def __init__(self, ownerComp: 'COMP'):
self.ownerComp = ownerComp

def generateSpec(self) -> Optional[str]:
spec = RaytkTools().loadROPSpec_NEW(ipar.inspectorCore.Targetcomp.eval(), checkExists=False)
spec = RaytkTools().loadROPSpec(ipar.inspectorCore.Targetcomp.eval(), checkExists=False)
if not spec:
return None
return yaml.dump(spec, default_style='', sort_keys=False)
Expand Down
Binary file modified devel/workArea/workArea.tox
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/_data/toolkit.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
toolkitVersion: '0.31'
toolkitVersion: '0.32'
2 changes: 1 addition & 1 deletion docs/_guide/output-buffers.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The [Inspector] is a great tool for exploring output buffers. It shows a list of

## Tutorial

<iframe width="560" height="315" src="https://www.youtube.com/embed/mhVVRjl-Z1g" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/hLRIZ0yz9DI" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>


[raymarchRender3d]: /raytk/reference/operators/output/raymarchRender3d
Expand Down
7 changes: 7 additions & 0 deletions docs/_reference/operators/camera/basicCamera.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@ op:
parameters:
- label: FOV Angle
name: Camfov
summary: Width of the view angle.
- label: Position
name: Campos
summary: Position of the camera.
- label: Rotate
name: Camrot
summary: Rotation of the camera view direction.
summary: Standard camera equivalent to a traditional Camera COMP with default settings.

---


Standard camera equivalent to a traditional Camera COMP with default settings.
2 changes: 2 additions & 0 deletions docs/_reference/operators/camera/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ cat:
name: camera
operators:
- name: basicCamera
summary: Standard camera equivalent to a traditional Camera COMP with default
settings.
- name: cameraRemap
status: beta
summary: Modifies a camera by replacing the pixel UV coordinates that are used
Expand Down
3 changes: 3 additions & 0 deletions docs/_reference/operators/camera/splitCamera.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ op:
summary: A camera that splits the viewport into several zones, each using a separate
camera.
thumb: assets/images/reference/operators/camera/splitCamera_thumb.png
variables:
- label: index
name: index

---

Expand Down
11 changes: 11 additions & 0 deletions docs/_reference/operators/convert/extrudeLine.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ redirect_from:
- /reference/opType/raytk.operators.convert.extrudeLine/
op:
category: convert
detail: The extrude operator goes along a selected axis, with a height center on
the origin. Instead of doing that, this operator extrudes so that one side is
centered at Point1 and the other end at Point2.
inputs:
- contextTypes:
- Context
Expand All @@ -23,6 +26,7 @@ op:
required: true
returnTypes:
- Sdf
summary: 2D SDF cross-section to extrude.
- contextTypes:
- Context
- MaterialContext
Expand Down Expand Up @@ -57,10 +61,17 @@ op:
- label: Point 2
name: Point2
status: beta
summary: Extrudes a 2D SDF cross-section into a 3D volume, like the extrude operator,
but between two points.
variables:
- label: axispos
name: axispos
- label: normoffset
name: normoffset

---


Extrudes a 2D SDF cross-section into a 3D volume, like the extrude operator, but between two points.

The extrude operator goes along a selected axis, with a height center on the origin. Instead of doing that, this operator extrudes so that one side is centered at Point1 and the other end at Point2.
5 changes: 5 additions & 0 deletions docs/_reference/operators/convert/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ cat:
summary: Creates a 3D SDF by extruding a 2D SDF along along an axis.
- name: extrudeLine
status: beta
summary: Extrudes a 2D SDF cross-section into a 3D volume, like the extrude operator,
but between two points.
- name: floatToSdf
summary: Converts a float value field into an SDF.
- name: floatToVector
Expand All @@ -34,6 +36,9 @@ cat:
summary: Projects coordinates into various types of polar spaces.
- name: revolve
summary: Creates a 3D SDF by revolving a 2D cross-section SDF around an axis.
- name: sampleAlongLine
status: beta
summary: Samples a 2D/3D input along a single line, producing a 1D function.
- name: sweep
summary: Creates a 3D SDF by sweeping a 2D SDF along the surface of another 2D
SDF.
Expand Down
3 changes: 3 additions & 0 deletions docs/_reference/operators/convert/projectPlane.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ op:
name: Plane
summary: Takes a 1D or 2D operator and converts it to a 3D operator by mapping it
to a plane within 3D space.
variables:
- label: axispos
name: axispos

---

Expand Down
54 changes: 54 additions & 0 deletions docs/_reference/operators/convert/sampleAlongLine.md
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.
16 changes: 12 additions & 4 deletions docs/_reference/operators/convert/vectorToFloat.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ op:
name: Enable
- label: Use Part
menuOptions:
- label: X
- label: X / Red
name: x
- label: Y
- label: Y / Green
name: y
- label: Z
- label: Z / Blue
name: z
- label: W
- label: W / Alpha
name: w
- label: Length(XY)
name: lengthxy
Expand Down Expand Up @@ -67,6 +67,14 @@ op:
name: avgxyz
- label: Average(XYZW)
name: avgxyzw
- label: Hue
name: hue
- label: Saturation
name: sat
- label: Value
name: val
- label: Luminance
name: luma
name: Usepart
summary: Which part of the vector to use for the float field.
summary: Converts a vector value field to a float field using one part of the vector.
Expand Down
Loading

0 comments on commit 554198c

Please sign in to comment.