renderer

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2022 License: GPL-3.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlbedoShader added in v0.2.0

type AlbedoShader struct{}

AlbedoShader outputs flat color

func (AlbedoShader) Shade added in v0.2.0

func (AlbedoShader) Shade(renderer *Renderer, rec *material.HitRecord, ray geo.Ray, depth int) geo.Vec3

Shade calculates the color only attenuation color.

type NormalShader added in v0.2.0

type NormalShader struct{}

NormalShader outputs the normals of the ray hitpoint

func (NormalShader) Shade added in v0.2.0

func (NormalShader) Shade(renderer *Renderer, rec *material.HitRecord, ray geo.Ray, depth int) geo.Vec3

Shade calculates the color only using normal.

type PathTracingShader

type PathTracingShader struct {
	MaxDepth int
}

PathTracingShader is the full raytracing shader

func (PathTracingShader) Shade

func (pts PathTracingShader) Shade(renderer *Renderer, rec *material.HitRecord, ray geo.Ray, depth int) geo.Vec3

Shade calculates the color using path tracing

type RenderConfig

type RenderConfig struct {
	SamplesPerPixel int
	Shader          Shader
	PostProcessor   post.PostProcessor
}

RenderConfig is input to the ray tracer for how the image should be rendered

type RenderProgress

type RenderProgress struct {
	Progress    float64
	RenderImage image.Image
	Error       error
}

RenderProgress is progress reported back to the caller of the raytrace function

type Renderer

type Renderer struct {
	// contains filtered or unexported fields
}

Renderer is a central part of the raytracer responsible for controlling the process reporting back progress to the caller

func NewRenderer

func NewRenderer(scene *Scene, output chan<- RenderProgress, abort <-chan bool) (*Renderer, error)

NewRenderer creates a new renderer given a scene and channels for communicating with the caller

func (*Renderer) Render

func (r *Renderer) Render(imageWidth, imageHeight int)

Render executes the rendering of the image

type Scene

type Scene struct {
	World           hittable.Hittable
	Camera          camera.CameraConfig
	BackgroundColor geo.Vec3
	RenderConfig    RenderConfig
}

Scene contains all information needed to render an image

type Shader

type Shader interface {
	Shade(renderer *Renderer, rec *material.HitRecord, ray geo.Ray, depth int) geo.Vec3
}

Shader calculates the color from a ray hitting a hittable object

type SimpleShader

type SimpleShader struct{}

SimpleShader is a simple shader for quick rendering

func (SimpleShader) Shade

func (SimpleShader) Shade(renderer *Renderer, rec *material.HitRecord, ray geo.Ray, depth int) geo.Vec3

Shade calculates the color only using normal and attenuation color.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL