aconstlink / motor

Software Framework for Audio/Visual/Interactive Real-Time Applications
MIT License
1 stars 0 forks source link

2d noise graphics object #68

Open aconstlink opened 2 months ago

aconstlink commented 2 months ago

A very nice feature would be to produce a noise texture in the backend with some default values but also with an opportunity for the user to change parameters.

First we might need a new graphics object: noise2d_object_t That new object is producing a 2d noise texture on the gpu and is accessible through the texture name if required via a variable in the shader.

Updating that texture could be done through a new update function in the backend. void_t update( noise2d_object_mtr_t ) ;

Or the run-time can somehow change variable changes.

aconstlink commented 1 month ago

At the moment, it is possible to create a noise texture on the cpu and use that in the shader via a texture lookup.

For this issue, it might make sense to introduce a new shader variable type and being able to access it through some new functions:

// in the msl shader
noise2d_t noise_lut ;
... 
noise( vec2_t(), noise_lut ) ;

The advantage of this method is clearly the ability to generate the noise texture itself on the GPU transparently to the user.