home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ARM Club 3
/
TheARMClub_PDCD3.iso
/
hensa
/
graphics
/
fractal_1
/
!Fractal
/
Help
/
Raycast
< prev
next >
Wrap
Text File
|
1996-10-13
|
8KB
|
180 lines
RayCast
~~~~~~~
RayCast is a 3D rendering system, like Render, 3D_Plane and 3D_View. However, it
differs in one major way: It uses a lighting model, which ultimately results in
a higher quality image than can be produced by the other 3D functions. However,
because of its versatility, it is slightly more tricky to use.
The smoother the source image, the better the final results.
Clear Files
----- -----
In order to escape !Fractal's limitation of 256 colours, RayCast has to write to
a file in a format called 'Clear.' These files are not sprite files, and are
much larger because 65,536 times as many colours are stored. As an example, a
Mode 21 (640x512) picture rendered in RayCast takes up around a megabyte!
To look at these files, a viewer is required. People with expensive Colour
Cards will probably already have a Clear file viewer, that will allow them to
view the pictures in thousands or maybe even millions of colours.
However, for people with normal systems, the ShareWare program Translatr or the
ChangeFSI application that comes with RISC OS 3 will do the job nicely.
Using RayCast
----- -------
When you have a fractal on the screen, that you want to render in 3D, select the
required palette (and shift it if needed) BEFORE invoking RayCast. Then select
RayCast from the 'Functions' panel on the main menu, and there will be a small
delay while raycast scans the image.
Then select the viewing elevation as required (though this can be done before
hand if needed) and bring up the RayCast data entry panel, either by clicking
on the appropriate tool bar icon, or using the menu entry. Set up these options
as required (a brief description of each is given below). Make sure preview is
still turned on. Remember to press OK to accept the values in the window.
Press the redraw icon on the tool bar, and watch a horrible dotty picture
being drawn. The purpose of this image is to show you where (or not) the
final picture will appear on screen, whether the water level is correct, etc.
If part of the image is off screen, try reducing the height scalar or twiddling
the elevation. An elevation of 45 degrees requires most screen space.
Note that the rotation is fixed. If you want to look at the picture from another
angle, rotate the image first.
Keep repeating these steps until the image is in the right place on the screen,
then go to the panel and turn preview off.
Now, go to the 'Write Clear File' entry on the menu, and save the icon
somewhere. Note, nothing will actually be saved, but the filename will have been
noted. Then press render again.
Now the picture will be rendered 3 times in a row - don't panic, the program
will still multi-task - but there will be pauses of about 30 second duration at
the end of each rendering while the computer writes out a colour component to
the Clear file. If multi-tasking, then the pointer will turn to an hourglass
while the disc writing is taking place. When this has finished, load the Clear
file into a viewer, sit back, and look at your wonderful creation.
What's What
------ ----
Light vector:
The image is light-sourced as though a single light source is shining onto
the surface, with a continuous emission of parallel photons (OK, this isn't
reality) i.e. the light is straight. These values govern the direction that the
light is shining towards. Note, the axes are as follows: X(horizontal),
Y(vertical) and Z(depth). i.e.:
Y Z
|\ /|
| /
| /
|/_______>X
Defaults:
Clicking this button will return some of the options in the window to their
defaults.
Smooth image:
Helps to eliminate bumpiness in the source image. Note this affects the
source image permanently each time a redraw is called. It averages each pixel
with each one of its neighbours.
Preview:
Governs whether a final rendering or a quick peep will be rendered.
Height Scalar:
The height scalar. Change this to alter the height mapping. A value of 1
means that all heights will be left unchanged.
Water:
Turn this on to place an imaginary 'water level' on the image. Enter a
value to the right for a water level. Use 50 for the Landscape palette. Water
will be coloured according to depth, and shadows will be cast onto the water.
Shadow detection:
If turned on, RayCast will cast shadows onto the landscape from the light
source. Note, this will mean rendering takes slightly longer.
Dither:
If turned on, the landscape colours will be scattered slightly, resulting
in a stippled effect that can sometimes help relieve the boredom of an image.
Script Interface
------ ---------
As RayCast does not use the usual data entry window, the data parameters have
to be changed using the Data command.
The commands supported are (all of which should be quite obvious):
water_level=xxx : Sets the water level to a given value (0-255).
water_on=0/1 : Is the water on/off?
dither_thresh=xxx : Sets the dither threshold as in the panel
dither_on=0/1 : Is dithering turned on or off?
smooth_on=0/1 : Turns smoothing on or off
light_dx=x.xxx : These set the light vector.
light_dy=x.xxx
light_dz=x.xxx
preview_on=0/1 : Is previewing on?
shadows_on=0/1 : Is shadow detection on?
height_scalar=xx.xx : Value of height scalar.
Note, if the window is open, these values will not automatically be updated
- you will need to click 'Defaults' or re-open the window. That latter is
more desirable, as it does not change any values.
Error Messages
----- --------
Here lies a short description of all the error messages that are likely to occur:
Inaccuracies will result if a component of the light vector is greater than 1!
You have set a component of the light vector to more than 1, which means
shadow checking may become inaccurate. Reduce it.
RayCast water level must be less than 256!
Quite obvious really.
RayCast dither level must be less than 256!
So is this...
This option will not work if preview is on in RayCast data window!
This serves as a reminder to tell you that, if you are using a Clear file,
RayCast will not render to it unless Preview is off.
No palette in source image!
The source sprite does not have a 256 colour palette (maybe loaded elsewhere).
NCLib is unable to initialise 3D projector. Probably short of memory!
RayCast has failed in its attempt to allocate memory for perspective tables.
Free some memory, and try again.
NCLib has experienced an error when writing Clear file!
One of the stdio functions returned an error when writing out a Clear file.
Probably short of disc space (these files get big!)
Error writing Blue component to Clear file!
Problem accessing the Clear file to write out a colour component.
(can also occur with red and green components).
Any other errors are generated by !Fractal itself.
Copyright
---------
The copyright of
RayCast, Stereogram, Sierpinski
belongs to Neil A Carson. No part of the code may be used in any other program
whatsoever without the author's permission.
However, Mike Curnow's word is my word, so if he says you can do something with
it, then it's fine by me.
Source code is obtainable together with the source for the rest of Fractal
(since it is not much use on its own) from Mike (with his permission) at the
address below.
Author
------
I can be contacted at:
1 Penn Close,
Abingdon,
Oxon OX14 2NX
Or on packet email, I am: neil@g7kqy.ampr.org [44.141.6.229]
(on ax25, Ben g7kqy@gb7avm may forward the odd message if you ask
him nicely).