Japanese
FAQSGL programming related
Back | ■
FAQ/SGL programming related

others



How to specifically use slColorCalc?

Q)
Please tell me how to use the slColorCalc function.
Also, what is the default value if this function is not called?

A)
This function simply sets the data area to be set in the color calculation control register.

VDP2 manual 12.1 Color calculation Data corresponding to the color calculation control register is set.
If this function is not called, color calculations are not performed. This is the same as the initial state of the hardware.


Does the slLookAt function affect all matrices?

Q)
How much of a burden does the internal processing of the function slLookAt have?

A)
The current matrix (at the time slLookAt is called; if nothing is being done, the environment matrix (the matrix that is the base of the calculation)) is simply multiplied by the value of the slLookAt function, so the processing time is is equivalent to one position conversion and one rotation conversion.

You can think of the slLookAt function as performing operations such as slTranslate and slRot* once on the current matrix for the camera coordinates.


I want to obtain a 2D coordinate system with SGL.

Q)
On page 4-3 of the SGL tutorial, it is stated that a 2D coordinate system is also maintained in addition to the virtual 3D space coordinates, but how can the data in the 2D coordinate system be referenced?

A)
Think of the 2D coordinate system as the coordinates (two-dimensional) sent to the command table of VDP1.
To view this coordinate data from the user side, use the slConvert3Dto2D function.

If local coordinate data for the current matrix is given as an argument, the value converted to the 2D coordinate system will be returned.


I want to play CDROM-XA with SGL.

Q)
I would like to play CD-XA files with SGL, but I can't find any documentation regarding XA anywhere. How should I actually create CDROM-XA?

A)
SGL does not have a library to play CDROM-XA, so you will need to use SBL's GNU C version of the PCM/ADPCM playback library. We are currently checking this library on SGL.


I want to use DGT2(PP).

Q)
How can I display 2D sprites using the DGT2(PP) file format?

A)
When converting DGT2 data to SGL data, use DG2TXR.EXE in the SGL package.

This converter supports all DGT2 modes, so it can also convert PP formats.

This tool is located in SATURN\SGL\TOOL.


I want to program the model data for each stage to be read each time.

Q)
In a game that uses polygons, I would like to read and reference different model data for each stage at a specific address, but how should I write this?

A)
This can be done by preparing a file for each model data used in each stage and using overlay techniques to load it from the CD according to each stage.

I think another method would be to prepare only the different data parts for each stage in separate sections.


I want to cast a shadow.

Q)
I don't know a good way to display the shadows of players in sports games, etc. Please let me know if there is a better way.

A)
If the player is a 3D polygon
Create one model exclusively for shadows. This model does not have to be exactly the same as the original, it can have as few polygons as possible.
Next, display the original model on the program.
The same current matrix is used to display the shadow model, but the size of the current matrix in the y direction is set to 0. The quickest way to set the size in the y direction to 0 is to set the size in the y direction to 0 before displaying the model.

slScale( toFIXED( 1.0 ), toFIXED( 0.0 ), toFIXED( 1.0 ) )

is to execute.

The shadow model then becomes a shadow parallel to the y-axis plane. If the ground is not parallel to the y-axis, changing the component given to slScale (specifically, it is related to the normal vector) will produce a shadow that looks like that.

There is also a way to manipulate the matrix directly.
In this case, you can also expect the effect of extending shadows as the sun sets.

[How to calculate shadow]

1                              0  0
slMulFX( slSin( ang ), long )  0  slMulFX( slCos( ang ), long )
0                              0  1

Direction of shadow by changing ang
You can adjust the length of the shadow by changing long.


I don't really understand how to use slConvert3Dto2D.

Q)
When using slConvert3Dto2D, if the X and Y values are too large or the Z value is too small and the display cannot fit within the 2D plane, how can I determine this?
Also, what does it mean to return the Z value as a function value?

A)
slConvert3Dto2D is a function that uses the current matrix to find out where the 3D coordinates specified by the user are on the 2D plane, but if the 3D coordinates specified go beyond the drawing area, the judgment is made by the user according to the resolution used. Determine from the side.
However, as with all SGLs, the origin is at the center of the screen, so care must be taken when making a distinction. Also, please note that the 3D coordinate values given are relative coordinates from the coordinate space indicated by the current matrix.
Also, Zpos, which is returned as the return value of this function, is usually used to find out if something is stuck in Z sort.

In SGL, the screen position is managed using the system variables MsScreenDist and SlScreenDist. Therefore, by using the near clipping position together with the system variable "MsZdpsfcnt", you can find out which coordinates will be the boundary value.


Back |■
FAQSGL programming related
Copyright SEGA ENTERPRISES, LTD. 1997