Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Volumetric Raymarching blog post #651

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/framer-motion-layout-animations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ keywords:
]
slug: framer-motion-layout-animations
type: 'blogPost'
featured: true
featured: false
colorFeatured: 'linear-gradient(90deg,#2E83FF -10%,#EB7D9F 50%, #FFCBBE 100%)'
fontFeatured: '#E8E8FD'
---
Expand Down
898 changes: 898 additions & 0 deletions content/real-time-cloudscapes-with-volumetric-raymarching.mdx

Large diffs are not rendered by default.

18 changes: 14 additions & 4 deletions core/components/BeforeAfterImage/BeforeAfterImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,25 @@ const BeforeAfterImage = (props: BeforeAfterImageProps) => {
onMouseMove={handleMouseMove}
onTouchMove={handleTouchMove}
style={{
width: width || '100%',
height: height || '100%',
// @ts-ignore
'--progress': `${wiggleMotion.get()}%`,
}}
>
<S.Image alt="Before" src={beforeSrc} />
<S.Image
alt="Before"
loading="eager"
src={beforeSrc}
width={width}
height={height}
/>
<S.Overlay>
<S.Image alt="After" src={afterSrc} />
<S.Image
alt="After"
loading="eager"
src={afterSrc}
width={width}
height={height}
/>
</S.Overlay>
<Slider />
</S.Wrapper>
Expand Down
7 changes: 7 additions & 0 deletions core/components/MDX/MDXComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
H3,
Strong,
} from '@maximeheckel/design-system';
import BeforeAfterImage from '@core/components/BeforeAfterImage';
import Callout from '@core/components/Callout';
import Code from '@core/components/Code';
import Fullbleed from '@core/components/Fullbleed';
Expand Down Expand Up @@ -185,6 +186,10 @@ const RaymarchingVisualizer = dynamic(
() => import('./Widgets/Raymarching/RaymarchingVisualizer')
);

const VolumetricRaymarchingVisualizer = dynamic(
() => import('./Widgets/Raymarching/VolumetricRaymarchingVisualizer')
);

const RefractionDispersionSandpack = dynamic(
() => import('./Widgets/RefractionDispersionReactThreeFiber/Sandpack')
);
Expand Down Expand Up @@ -257,6 +262,8 @@ const customComponents = {
DemoSearch,
DemoButton,
RaymarchingVisualizer,
VolumetricRaymarchingVisualizer,
BeforeAfterImage,
// Sandpacks
CSSCompositionSandpack,
ScrollSpySandpack,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ const fakeSphereSDF = (_x: number, _y: number, step: number) => {

const SIZE = 17;
const MAX_STEP = 13;
const FragmentShaderVisualizer = () => {

const RaymarchingVisualizer = () => {
const [step, setStep] = useState(0);

const emptyMatrix = useMemo(
Expand Down Expand Up @@ -811,4 +812,4 @@ const Diagram = (props: { step: number }) => {
);
};

export default FragmentShaderVisualizer;
export default RaymarchingVisualizer;
18 changes: 18 additions & 0 deletions core/components/MDX/Widgets/Raymarching/Sandpack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ import InfinitySpheres from './infinitySpheres';
import MengerFractal from './mengerFractal';
import NoiseDerivatives from './noiseDerivatives';
import MartianLandscape from './martianLandscape';
import VolumetricRaymarching from './volumetric';
import VolumetricRaymarchingWithFBM from './volumetricNoise';
import DirectionalDerivative from './directionalDerivative';
import MorphingCloud from './morphingCloud';
import BlueNoiseDithering from './bluenoiseDithering';
import BicubicFiltering from './bicubicFiltering';
import BeersLaw from './beersLaw';
import LightTransmittance from './lightTransmittance';
import Phase from './phase';

const CSSCode = `
html {
Expand Down Expand Up @@ -46,6 +55,15 @@ const RenderTargetsSandpack = (props: any) => {
scene8: MengerFractal,
scene9: NoiseDerivatives,
scene10: MartianLandscape,
scene11: VolumetricRaymarching,
scene12: VolumetricRaymarchingWithFBM,
scene13: DirectionalDerivative,
scene14: MorphingCloud,
scene15: BlueNoiseDithering,
scene16: BicubicFiltering,
scene17: BeersLaw,
scene18: LightTransmittance,
scene19: Phase,
};

return (
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './VolumetricRaymarchibgVisualizer';
Loading
Loading