-
Notifications
You must be signed in to change notification settings - Fork 0
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
Implement image tracer #3
Merged
Merged
Conversation
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
Co-authored-by: Samuele-Colombo <Samuele-Colombo@users.noreply.github.com>
Co-authored-by: Samuele-Colombo <Samuele-Colombo@users.noreply.github.com>
src/cameras.jl
Outdated
0 <= u <= 1 || throw(ArgumentError("argument `u` must be bound to the range [0, 1]: got $u")) | ||
0 <= v <= 1 || throw(ArgumentError("argument `v` must be bound to the range [0, 1]: got $v")) | ||
origin = Point(-camera.distance, 0, 0) | ||
direction = Vec(camera.distance, (1.0 - 2 * u) * camera.aspect_ratio, 2 * v - 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Paolo Galli <Paolo97Gll@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implementation of the image tracer to capture light from a scene.
It is necessary to implement the following:
Ray
,a
struct
representing a ray from a origin up to a maximum distance. ;(r::Ray)(t::Real)
,we must be able to sample the ray. We opt to implement this by rendering the
Ray
type callable;≈
,we compare rays only through the starting point and direction;
*
with aTransformation
,allowing camera manipulation through multiplication;
Camera
,cameras have a rectangular virtual screen (the properties of which are defined by the aspect ratio), an observer at a given distance, and a transformation to represent orientation and translation;
PerspectiveCamera
,represents a camera capturing rays converging onto the observer at a finite distance from the screen;
OrthogonalCamera
,represents a camera capturing rays coming from a direction normal to the screen (as if the observer was at an infinite distance)
fire_ray
method,returns a ray passing through a given point on the screen. Must be specialized for each concrete subtype of
Camera
to represent their different behaviors;aperture_deg
method,returns the FOV angle of our camera in degrees;
ImageTracer
,an agent
struct
that fills anHdrImage
with the information collected by aCamera
;fire_ray
method,similar to the
Camera
method but this takes discrete pixel coordinates from the image instead of the continuous screen coordinates. Additional information must be provided on the exact origin of the ray within the pixel;fire_all_rays
method,iterating the
fire_ray
method on all pixels. The method must also accept aFunction
argument with instructions on how to calculate whatRGB
object to store in the image;