Author Topic: fun little toy I just made for the hell of it  (Read 5809 times)

0 Members and 1 Guest are viewing this topic.

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
fun little toy I just made for the hell of it
I've had this idea floating around for quite a while now for making a procedural texture maker, and after some of the things I've had to do over the last few weeks, I finally decided to give it a wurl.

I give you the first and posably last installment of prox (procedural proxy) the 2d function visualizer.
useing the long abandoned expression code I made years ago, before we had a scripting system, wich was promptly abandoned in favor of said scripting system, due to it being better, I have made a program that will  display any function of x and y you can type up into the three color chanels of red green and blue.

the syntax is incredibly assinine and unforgiving and is more likely to crash than simply not work if you do anything even remotely not perfect, speaking of wich it goes a little something like this
color_chanel: expression ;<-semicolon,
a beter example would be like this
red:255;
that will set the red chanel to full brightness, but making textures of a constant color is a bit boring, what you need are variables, all variables will be of the form :variablename:, I might add suport for defining your own variable later, but I don't feel like it now, as of this moment, there are four variables, upper and lower case x and y, upper case is centered in the middle of the screen, lower case is centered at the upper left han corner.

a specific example of how to use them

red:(sin((:X:^2+:Y:^2)*20)/2+.5)*255;
green:(sin((:X:^2+:Y:^2)*20+5)/2+.5)*255;
blue:(sin((:X:^2+:Y:^2)*20+10)/2+.5)*255;

note the colins and semicolins.
« Last Edit: February 17, 2007, 09:21:53 pm by Bobboau »
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Scuddie

  • gb2/b/
  • 28
  • I will never leave.
Re: fun little toy I just made for the hell of it
Screenie?  And maybe try uploading a zip file that isnt broken?
Bunny stole my signature :(.

Sorry boobies.

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Re: fun little toy I just made for the hell of it
the zip works fine for me...

fine, new zip, I've added polar coordanants in there as well ( :ang: :r: ) so I should update it anyway
« Last Edit: February 17, 2007, 09:22:07 pm by Bobboau »
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: fun little toy I just made for the hell of it
If you're having trouble running the app due to missing DLL errors, try this:

http://www.microsoft.com/downloads/details.aspx?FamilyId=32BC1BEE-A3F9-4C13-9C99-220B62A191EE&displaylang=en

If you're using a 64-bit version of Windows, you can find the appropriate links at the bottom.

EDIT: Hmm, I'm not getting the same results as you, apparently. How do I make mine look cool like yours?

[attachment deleted by admin]
« Last Edit: January 20, 2007, 02:48:41 am by WMCoolmon »
-C

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Re: fun little toy I just made for the hell of it
well first off in your red row you put cost rather than cos, but it should still be comeing up as something semetrical.

maybe I should port this over to wx
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Re: fun little toy I just made for the hell of it
made another one, these can be quite good as laser bolt textures

maybe I should post this elsewere, I'm sure the modders would be interested in this.

[attachment deleted by admin]
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: fun little toy I just made for the hell of it
not bad i will play with this for abit. this oddly reminds me winamp avs. which can be programmed quite well with its system. my main reason for wanting procedural textures would have to be for cockpit panels. but i still cant get that to work.

I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Re: fun little toy I just made for the hell of it
I originally got the idea (and programed some of the code) when I was making a media player visualization. basicly all I have done is taken the code for setting the contents of a window to a particular color and spliced my expression code into it.

anyway...
and you shall tears of scarlet!
(experiment with trig functions of :ang: + :r:)
« Last Edit: February 17, 2007, 09:22:32 pm by Bobboau »
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: fun little toy I just made for the hell of it
How rapidly could these calculations be performed on a 3D surface texture using the RTT functions? (Read: auto-scaling textures)
-C

  

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Re: fun little toy I just made for the hell of it
well the biggest slowdown seems to be from the loop or inedexing the array, humangus lines seem to take just about as long as simple ones, so I'd guess fairly fast, but I wouldn't dare do a 3d texture on the fly. but I very much have the idea of introducing a time variable and haveing the thing spit out sequences of images, that could very easily be made to also render to a surface of a 3d texture.

btw right now I'm woking on a way to define your own variables, and HSL output mode, actualy the HSL mode is coming first, but I'm keeping in mind the variables when I write it.

and I have got to change the syntax.

I'm thinking

:variable: = expression
useing '\' to denote that a endline should not be treated as the end of the expression

though using a special character would make it a lot easier, like maybe
@:variable: = expression

and

$output<RGB>{
:red:
:green:
:blue:
}

would define an output (were :red:, ect, were variables you defined)

I could probly do functions too, but they would need to use different brackets.

you know I could have sworn I had more functions defined...
« Last Edit: January 20, 2007, 06:00:09 am by Bobboau »
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Trivial Psychic

  • 212
  • Snoop Junkie
Re: fun little toy I just made for the hell of it
All this is quite beyond me, but you seem to be discussing textures that can change in game, like anis, but without needing the multiple frames of an ani or eff... is that anywhere near what this is leading to?  Is this kinda thing aiming towards being able to reproduce the pulsing glowmap effects of the Shivan fighters in adveffects, without needing the memory-hogging anis?  Just trying to cut through the code-talk and get something that I can relate to.
The Trivial Psychic Strikes Again!

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Re: fun little toy I just made for the hell of it
no, but this could be used to make animated textures
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: fun little toy I just made for the hell of it
if implemented perhaps we could use the eff files to store the expressions. i wouldnt mind this if i could pass it vars from scripting. might just get those working panels i wanted.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Re: fun little toy I just made for the hell of it
no, this isn't going to get into FSO ever, maybe WMC and taylor can work together for script defined textures, but the expression code isn't powerfull enough or stable enough for use in FSO, it is fairly fast and simple though, and I'd like to have some app based on it as I think it was rather clever of me.

I have made some changes, I decided to do the user variables first, they are sort of function like in that placeing a instance variable will change it's value.

this is the new syntax, you define a bunch of variables, and then an output in wich you specify the variables to use

@R=1-:r:

@red=:R:

@green=:R:*1.1

@blue=:R:*.9

$output<rgb>{
:red:
:green:
:blue:
}

next up HSL output



[attachment deleted by admin]
« Last Edit: January 21, 2007, 05:49:50 am by Bobboau »
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Re: fun little toy I just made for the hell of it
@H=:r:/8

@S=(1-:r:)*2

@L=1-:r:

$output<hsl>{
:H:
:S:
:L:
}

I changed some settings so it links statically, is it still not working for anyone?

[attachment deleted by admin]
« Last Edit: January 21, 2007, 05:55:22 am by Bobboau »
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: fun little toy I just made for the hell of it
Still not quite working for me...

[attachment deleted by admin]
-C

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Re: fun little toy I just made for the hell of it
is your screen running in 16bit mode, or anything other than 32bit mode?
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline CP5670

  • Dr. Evil
  • Global Moderator
  • 212
Re: fun little toy I just made for the hell of it
I tried out a few things with this. What ranges do the X and Y variables run over?

This needs to be used in the game itself for animations. You could use it make high resolution and detailed effects without using much memory.

Here's an interesting one around an essential singularity. Does this thing work with complex variables?

[attachment deleted by admin]

 
Re: fun little toy I just made for the hell of it
Quote
You could use it make high resolution and detailed effects without using much memory.
Exactly what I thought but was afraid to say.  :) Just like the Help/About screen in µTorrent.

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Re: fun little toy I just made for the hell of it
most variables go in the range of 0-1,

:x:, :y:, :r:, and :t: go from 0 to 1 (:r: actualy goes to sqrt(2) in the corners)
:X: and :Y: (note capitalisation) go from -1 to 1
:ang: goes from 0 to 2*PI
note if you find this isn't how things are working it's a bug. I'm looking into something right now that makes me think :ang: might be between -PI and PI, I might keep it this way though, what do you think?
I figured these woulf be the most maliable ranges for these, cause if you wanted a function that changed, say, from -2 to  11, along lets say x, you'd just have to set a variable like this
@NEWX=:x:*13-2
and instead of :x: you'd use :NEWX:

make sure you use the most recent build (in the other thread, cause in addition to more functionality, I also fixed a bug with :ang:)
er... you know what, I'll atach the most recent version (posably more reacent than the other thread) you will still need the DLL pack from the other thread.

if this was used in game it would use just as much memory, because every frame would still need to be rendered, though it would save on download sizes. now on the other hand this could be a useful tool in comeing up with stuff for pixel shaders that use no texture at all, as this is effectively one big slow system memory pixel shader.

all output chanels are in the range of 0 to 1 were 0 is totaly off and 1 is totaly on (exept hue wich wraps around, 0 and 1 are red, .5 is green .75 is blue/purple, .25 is yellow/green, hsl is sort of like polar coordanants with H being equivelent to theta).
so you need to normalise your output to this, on drawing anything greater than 1 is clamped to 1, and less than 0 to 0, now this is after evaluation, so you can have negitive values, it's just that when it's drawn on screen it shows up as black. you can invoke this function in your code if you think it will be usefull (anything with a divide over (aproching) zero in it for instance, like tangent functions) with clamp().

by complex variables do you mean i? no, but I'll look into it, I don't think i would be to hard to incorporate into the code (I'd just have to add a second double and use the appropriate math in the appropriate places), I could even include output modes for it. if you promise to use it that is ;)

I was also considering adding iterative abilities (wich could allow you to fake diferentiation/integration and do series convergence) but that's going to have to wait untill after I figure out how to get user defined functions to work (and I don't mean those psudo functional variables

also a few hidden functions that use non-standard notation (because its a requierment of the odd syntax I started with)
b#x == the b'th root of x
b~x == the log base b of x
comparison opperators (>,<,=) return 1.0 for true and 0.0 for false
and modulus is %

also there are built in constants PI and E (case sensitive, I know e is suposed to be lower case but it's my screwy syntax) if there are any others you'd like I'd be happy to include them. there is also a built in variable called :srand: wich is a static random, it gets changed everytime you evaluate to something between 0 and 1 (it would be diferent in each frame of an animation)

while I'm at it here is a complete list of all unary functions currently supported:
hypsin
hypcos
hyptan
arcsin
arccos
arctan
sin
cos
tan
log
ln
sqrt
deg (degree to radian)
rad  (radian to degree)
!   (factorial, it works a bit oddly !(:var:) rather than :var:! as you would expect)
abs
ipart (returns only the whole number)
fpart (strips off whole numbers, leaveing only the less than 1 part)
sign (returns -1 or 1)
not (returns 0 if you pass it 1, zero under all other cases)
clamp (returns 1 if passed over 1, 0 if under 0)


if this starts getting used I'm likely to rework the syntax

oh and if you plan on doing animations here is a tip, evaluate at t=0 and t=1 it the two images look exactly the same it will loop seamlessly.

[attachment deleted by admin]
« Last Edit: January 25, 2007, 07:03:06 am by Bobboau »
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together