camera

package
v0.0.0-...-c352d6b Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSpectralBinCount = 64
	MaxSpectralBinCount     = 4096
)

Film is a scene-linear spectral image. It deliberately carries no observer, tristimulus working space, display transform, or image-encoding policy.

Variables

This section is empty.

Functions

func PixelIndex

func PixelIndex(x, y float64, width, height int) (int, bool)

Types

type BidirectionalCamera

type BidirectionalCamera interface {
	ProjectiveCamera
	Endpoint() *mat.VecDense
	PDFDirection(direction *mat.VecDense) float64
}

BidirectionalCamera exposes the endpoint information and directional density required to put camera sampling in the same path-space measure as light and surface sampling. The density is with respect to solid angle and includes uniform sampling over the complete film, rather than conditioning on one already-selected pixel.

type Camera

type Camera struct {
	Film *Film
}

func (Camera) GetFilm

func (c Camera) GetFilm() *Film

type Camera3D

type Camera3D struct {
	Camera
	Position     *mat.VecDense   // Camera origin in scene space.
	Coordinates  []*mat.VecDense // Camera basis vectors: forward, right, up.
	FieldOfViews []float64       // Vertical and horizontal field-of-view angles in degrees.
	Ortho        bool            // Uses orthographic projection when true.
	// contains filtered or unexported fields
}

func NewCamera3D

func NewCamera3D() *Camera3D

func (*Camera3D) Endpoint

func (c *Camera3D) Endpoint() *mat.VecDense

func (*Camera3D) GenerateRay

func (c *Camera3D) GenerateRay(res *renderray.Ray, index ...int) *renderray.Ray

func (*Camera3D) PDFDirection

func (c *Camera3D) PDFDirection(direction *mat.VecDense) float64

func (*Camera3D) Prepare

func (c *Camera3D) Prepare() error

func (*Camera3D) ProjectPoint

func (c *Camera3D) ProjectPoint(point *mat.VecDense) (FilmProjection, bool)

ProjectPoint maps a world-space point to the box-filtered pinhole film. The returned Jacobian omits the receiving surface cosine because the camera does not know that surface's normal.

type CameraNDim

type CameraNDim struct {
	Camera
	Position     *mat.VecDense   // Camera origin in N-dimensional space.
	Coordinates  []*mat.VecDense // Camera basis vectors.
	FieldOfViews []float64       // Field-of-view angle per dimension.
	Ortho        bool            // Uses orthographic projection when true.
	// contains filtered or unexported fields
}

func NewCameraNDim

func NewCameraNDim() *CameraNDim

func (*CameraNDim) GenerateRay

func (c *CameraNDim) GenerateRay(res *renderray.Ray, x ...int) *renderray.Ray

func (*CameraNDim) Prepare

func (c *CameraNDim) Prepare() error

type CameraType

type CameraType string
const (
	CameraType3D         CameraType = "3d"
	CameraTypeNDim       CameraType = "n_dim"
	CameraTypeHyperbolic CameraType = "hyperbolic"
	CameraTypeSpherical  CameraType = "spherical"
)

type Film

type Film struct {
	Shape            []int                   `json:"shape"`
	OutputFilm       string                  `json:"output_film,omitempty"`
	PixelWindows     []PixelWindow           `json:"pixel_windows,omitempty"`
	Samples          int64                   `json:"samples"`
	SpectralBinCount int                     `json:"spectral_bin_count,omitempty"`
	SpectralBins     []maths.Tensor[float64] `json:"spectral_bins"`
	SpectralMinNM    float64                 `json:"spectral_min_nm"`
	SpectralMaxNM    float64                 `json:"spectral_max_nm"`
}

func NewFilm

func NewFilm(shape ...int) *Film

func (*Film) ElementCount

func (f *Film) ElementCount() int

func (*Film) HasSpectralBins

func (f *Film) HasSpectralBins() bool

func (*Film) Init

func (f *Film) Init(shape ...int) *Film

func (*Film) InitSpectralBins

func (f *Film) InitSpectralBins(count int, minNM, maxNM float64)

func (*Film) LoadFromFile

func (f *Film) LoadFromFile(filename string) error

func (*Film) RecordSpectralSample

func (f *Film) RecordSpectralSample(pixel int, wavelengthNM, value float64)

func (*Film) Reset

func (f *Film) Reset()

Reset clears accumulated radiance while preserving the Film configuration.

func (*Film) SaveToFile

func (f *Film) SaveToFile(filename string) error

func (*Film) SpectralBinCenterNM

func (f *Film) SpectralBinCenterNM(bin int) float64

func (*Film) SpectralBinIndex

func (f *Film) SpectralBinIndex(wavelengthNM float64) int

type FilmProjection

type FilmProjection struct {
	Position []float64
	ToCamera *mat.VecDense
	Distance float64
	Jacobian float64
}

FilmProjection describes the pinhole-camera mapping of a scene point. Jacobian converts an area density at the point into a box-filtered pixel density; callers multiply it by abs(dot(surfaceNormal, ToCamera)).

type HyperbolicCamera

type HyperbolicCamera struct {
	Camera3D
	// contains filtered or unexported fields
}

HyperbolicCamera is a Camera3D whose local camera frame is orthonormalized under the Klein H^3 metric at the camera position. In the Klein model, geodesics are Euclidean chords, but angles and field-of-view live in the tangent metric g_p rather than in the ambient Euclidean dot product.

func NewHyperbolicCamera

func NewHyperbolicCamera() *HyperbolicCamera

func (*HyperbolicCamera) GenerateRay

func (c *HyperbolicCamera) GenerateRay(res *renderray.Ray, index ...int) *renderray.Ray

func (*HyperbolicCamera) Prepare

func (c *HyperbolicCamera) Prepare() error

type PixelWindow

type PixelWindow struct {
	Min []int `json:"min"`
	Max []int `json:"max"`
}

func NormalizePixelWindows

func NormalizePixelWindows(windows []PixelWindow, shape []int) ([]PixelWindow, error)

type ProjectiveCamera

type ProjectiveCamera interface {
	RayCamera
	ProjectPoint(point *mat.VecDense) (FilmProjection, bool)
}

ProjectiveCamera is implemented by cameras that can receive light-tracing splats. ProjectPoint is the inverse of GenerateRay's raster mapping.

type RayCamera

type RayCamera interface {
	GenerateRay(res *renderray.Ray, index ...int) *renderray.Ray
	GetFilm() *Film
}

type SpectralSample

type SpectralSample struct {
	WavelengthNM float64
	Value        float64
}

type SphericalCamera

type SphericalCamera struct {
	Camera
	Position     *mat.VecDense
	Coordinates  []*mat.VecDense // Camera basis vectors: forward, right, up.
	FieldOfViews []float64       // Vertical and horizontal field-of-view angles in degrees.
	// contains filtered or unexported fields
}

SphericalCamera lives on S^3 embedded in R^4. Position is a unit vector; Coordinates are R^4 basis vectors projected into T_p and orthonormalized at Prepare time.

func NewSphericalCamera

func NewSphericalCamera() *SphericalCamera

func (*SphericalCamera) GenerateRay

func (c *SphericalCamera) GenerateRay(res *renderray.Ray, index ...int) *renderray.Ray

func (*SphericalCamera) Prepare

func (c *SphericalCamera) Prepare() error

Jump to

Keyboard shortcuts

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