Old 24th August 2011, 17:40   #1
Psyne
Junior Member
 
Join Date: Jul 2011
Posts: 11
Shader clarification

Hi all,

I've been playing with preset editing for a while now, and am feeling like I have a pretty solid understanding of Milkdrop's fundamental components. I would like to dive into the realm of shaders now, but am having trouble understanding a piece of the wiki regarding the different kinds of textures and the tex2D and tex3D functions.

The wiki states
Quote:
There are 3 types of textures we can access in Milkdrop; sampler_main, noise textures and custom textures.The latter two are covered very well in the preset authoring guide...
I'm not entirely sure what this is referring to when it speaks of noise textures and custom textures, likely because I have not heard them called textures before. Can someone clarify?

Syntax for tex2D seems straightforward: the first argument defines the texture from which to sample, the second, a float2, specifies a location on that texture. The tex3D function, however, is never used, nor clearly explained. I assume the difference is that the input for the second argument should be a float3? I imagine the usefulness of tex3D will be more apparent when I understand the other textures...

Thanks for any assistance you can render; it's very much appreciated!
Psyne is offline   Reply With Quote
Old 24th August 2011, 19:32   #2
Nitorami
Major Dude
 
Join Date: Mar 2008
Location: Erlangen
Posts: 867
Hi Psyne

MD has three predefined noise textures: sampler_noise_lq, _mq, and _hq.
Call them like this

ret = tex2D (sampler_noise_hq,uv);

As sampler_main, they can be called using the modifiers _pc_, _pw_, _fw_ and _fc_ which affect the smoothing and folding. Example

ret = tex2D (sampler_pw_noise_lq,uv);

The default is _fw_, to use the other versions you need to specify them in the shader header first

sampler sampler_pw_noise_lq;

Custom texture is simply a picture, jpg or pcx or whatever formats are supported. You need to define it in the header first

sampler sampler_mypicture;

and can then use it within the shader body by

ret = tex2D (sampler_mypicture, uv);

Normally the picture will not have the same aspect ratio as your screen so you'll may want to adjust this as specified in the authoring guide.

Martin
Nitorami is offline   Reply With Quote
Old 24th August 2011, 23:24   #3
Psyne
Junior Member
 
Join Date: Jul 2011
Posts: 11
Ah, that makes sense. Pardon me for the barrage of questions; just trying to wrap my head around this...

Edit: never mind the crossed-out questions, after looking around a little bit, I have realized that I am obviously blind.
  • What do the noise textures sample, exactly?
  • Is there an updated version of the preset authoring guide that I should pick up? I am sure, now, that I didn't see anything about noise textures in the one that came with my copy of Milkdrop.
  • Has anyone compiled something containing a full list of the variables and functions that the shaders use and, preferably, their syntax?
  • If calling numbers from the noise textures requires the tex2D function, what good is the tex3D function?

Last edited by Psyne; 24th August 2011 at 23:28. Reason: Answered some of the questions asked by myself!
Psyne is offline   Reply With Quote
Old 25th August 2011, 20:14   #4
Nitorami
Major Dude
 
Join Date: Mar 2008
Location: Erlangen
Posts: 867
As a beginner, you won't need more than the basic syntax, how to declare variables etc. We have float, float2 (for x-y-coordinates such as uv), float3 (mainly for colours, i.e. red, green and blue), and float4.

Some elementary functions are useful such as length(x) which gives you the length of a vector; you can use trigonometric functions sin, cos, etc. with all types of variables.

For a complete list you may refer to the microsoft guide
http://msdn.microsoft.com/en-us/libr...=VS.85%29.aspx
Nitorami is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Visualizations > MilkDrop > MilkDrop Presets

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump