Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, ChrstphFr), 864 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Pre-calculated matrix values #17958
10/09/03 21:35
10/09/03 21:35
Joined: Aug 2003
Posts: 105
Burgess Hill, United Kingdom
EdP Offline OP
Member
EdP  Offline OP
Member

Joined: Aug 2003
Posts: 105
Burgess Hill, United Kingdom
I'd like to pre-calculate the constant coefficients for a 4x3 matrix in C-Script, and transfer these values to a vertex shader script. Reading the release notes, it looks like I can just do this using Material skills 1..4, 5..8, and entity skills 41..44. Is this the only way of achieving my objective, or have I misread the release notes?

If possible, I'd like to have the flexibility of adding additional precalculated constant values in order to minimise the amount of calculation carried out within the shader script itself.


Ed
Re: Pre-calculated matrix values [Re: EdP] #17959
10/09/03 22:46
10/09/03 22:46
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
I can add a user var array that you can use for a precalculated matrix. What you you want to use this matrix for, and would it be better to have one global matrix, or a separate precalculated matrix per material?

Re: Pre-calculated matrix values [Re: jcl] #17960
10/09/03 23:47
10/09/03 23:47
Joined: Aug 2003
Posts: 105
Burgess Hill, United Kingdom
EdP Offline OP
Member
EdP  Offline OP
Member

Joined: Aug 2003
Posts: 105
Burgess Hill, United Kingdom
I have developed a time of day sky simulation, using rough approximations of Rayleigh and Mie scattering plus a pollution variable. All of this can be expressed as the coefficients of a 4x3 matrix. However, the calculations of these coefficients is somewhat complicated, and would probably bring a shader down to a crawl. I'd therefore like to calculate these coefficients outside the shader script on a much longer refresh time.

The vector that goes with these coefficients is dependent on various powers of a sky hemisphere vertex/sun position distance and will have to be calculated within the vertex shader routine. The m4x3 result will be output to the rgb values for each vertex. (I hope that this explaination is not too condensed or obscure!).

As you will see from the above, I'm not actually using material data at this stage, its a pure vertex shader. That said, I'd like to add a cloud simulation at a later stage when material data/pixel shaders would probably have to be used.


Ed
Re: Pre-calculated matrix values [Re: EdP] #17961
10/10/03 00:11
10/10/03 00:11
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Ok, I'll add a 4x4 matrix to the material properties.

Re: Pre-calculated matrix values [Re: jcl] #17962
10/10/03 02:01
10/10/03 02:01
Joined: Aug 2003
Posts: 105
Burgess Hill, United Kingdom
EdP Offline OP
Member
EdP  Offline OP
Member

Joined: Aug 2003
Posts: 105
Burgess Hill, United Kingdom
Thanks! Would it be too much to ask for both a general purpose 4x4 global matrix, as well as a material one? The shader articles I've read push towards offloading as much as possible onto the cpu leaving only essential calculations for the shader. From my inexperienced viewpoint there would seem to be some value in maximising the ability to transfer pre-calculated data to the shader routine.

For example, given the use made of Perlin noise in many shaders, it could be useful to have a noise generator in C-Script (even better as pre-built code), and a route to transfer data subsets to the shader.


Ed
Re: Pre-calculated matrix values [Re: jcl] #17963
11/24/03 20:02
11/24/03 20:02
Joined: Aug 2003
Posts: 105
Burgess Hill, United Kingdom
EdP Offline OP
Member
EdP  Offline OP
Member

Joined: Aug 2003
Posts: 105
Burgess Hill, United Kingdom
I guess this is still to come in a future beta release, or have I misread the release notes again!


Ed
Re: Pre-calculated matrix values [Re: EdP] #17964
11/24/03 21:31
11/24/03 21:31
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
I guess you must have misread almost all of it, then...

Re: Pre-calculated matrix values [Re: jcl] #17965
11/26/03 00:49
11/26/03 00:49
Joined: Aug 2003
Posts: 105
Burgess Hill, United Kingdom
EdP Offline OP
Member
EdP  Offline OP
Member

Joined: Aug 2003
Posts: 105
Burgess Hill, United Kingdom
Thanks!
I obviously did something crazy the last time I updated the beta, and I was running with the out of date version. No wonder I couldn't see anything new!


Ed

Moderated by  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1