REBOL3 - gfx math (Graphics or geometry related math discussion [web-public])

Return to Index Page
Most recent messages (300 max) are listed first.

#UserMessageDate
81Anton*That*'s the kind of website I was after, thanks Oldes.14-Jan-09 6:04
80BrockInteresting stats in the lower right corner of the page... About Colourlovers. An idea of what we could have for the AltME stats on Rebol.org as suggested in another group.13-Jan-09 17:44
79RobertYes, cool.13-Jan-09 17:13
78Henriknice one, Oldes.13-Jan-09 16:58
77OldesThis site is good for color picks http://www.colourlovers.com/13-Jan-09 16:52
76Anton(I appreciate all the technical details very much, however.)13-Jan-09 15:36
75AntonI'm mostly concerned with communicating as simply and directly as possible to the user the current overall progress of some operation (multiple file download is first application).13-Jan-09 15:33
74AntonWow - you guys. This is very interesting, but, going too far for my purpose at the moment. I *really* like the idea of having the simplest, most robust code possible. Adding so many visual effects and detail is something for a computer game.13-Jan-09 15:21
73Maximif your base color is some kind of darkish brown, it will glow from brown to orange to yellow to white. the bluish tint usually comes from the surface which "blues" because its exposed to heat. not all metals "blue". some melt before getting that hot.12-Jan-09 21:02
72Maximthe same probably applies wrt the way the color spreads out over the time it cools down and/or the distance from a single hot point.12-Jan-09 21:01
71Maximthe different hues, will build themselves up based on the falloff your particles are spreading out at.12-Jan-09 21:00
70Maximalso don't forget that light is additive, so sometimes, all you need to do, in visual effects, is add up an immense number of very dark particles. where they are tightly packed, it will create a ball of white, by iteself.12-Jan-09 20:59
69ReichartThis photo drives this point perfectly

http://www.richard-seaman.com/Aircraft/AirShows/Nellis2006/Extras/BelgianF16Afterburner.jpg

See how the jets are making the left wing blurry...this is what makes it look hot more than even seeing the jet itself. That just tells you the source, not that it is so hot it messes up the air.

12-Jan-09 17:24
68ReichartMay I suggest that:

- Starting with just cold metal - metal is not a single colour. You are seeing many colours at all times, and different patches of colour everywhere. You are seeing colours reflected and you need a coefficient table to calculate the reflection index. Copper for example would lean heavily towards red.

- Next, heated metals are the same, meaning, not a single colour either, but now for a different reason. But to produce the illusion of something burning hotter and hotter will require something that is multi-pass, and changing constantly.

In video games to produce the afterburner on a jet we did a few tricks:

- The jet flame itself was made of a cone-like shape (maybe a dozen polygons). - The cone was set with an alpha channel so that the source was close to opaque, and the tip was close to translucent. - A second cone was placed around the first cone, but just slightly larger. - They both undulated at all times. In other words, the length was always changing for both cones independently just slight. And when the jet went faster and slower, they changed from long to flat (with the plane itself). - The textures on the polygons were already a rainbox of colours, but as the jet changed what it was doing, the colour pallet was changed. Again, both cones were not always changed at the exact same time. - Just behind the jet (but depending on your angle of view), several filters (polygons that read the bg info and render again) would be used to create a small waiver and a refocusing. The more GPU you had, the more of this you could do, and the better the final effect would look. - Lastly, and this is what makes the whole thing amazing in a 3D game. We are always checking the location of bright things, such as the sun, or things like the after burner filling your screen. If so, we change the contrast of the whole world, and flare out your iris. In the case of the sun we throw up a lens flare, and darken all the ships in the sky.

Even as a 2D problem, you should attach this the same way.

This video I think drives this all home for you.

http://www.youtube.com/watch?v=mHL94qQgl_8&feature=related

12-Jan-09 17:19
67AntonI don't think I mentioned what I wanted the colours for - a progress bar. After consideration, I've pretty much decided that a large range of colours such as cooling metal might go through might actually be bad for the user interface (unless extreme measures are taken to make it really look like molten metal, like a computer game programmer might do), because all those colours might be confusing, and some of them (eg. red) may signal warning, etc. (especially if the user hasn't seen the progress bar before - I don't want to present the user with a circus of colours). Fading from white to solid blue is what I'm using at the moment, and I'm thinking white might be too bright.12-Jan-09 15:05
66AntonI don't know, I haven't had time to check Wikipedia thoroughly. But as we consider it more closely, we can see many factors contribute to the final colours.12-Jan-09 14:56
65GabrieleWhat different materials differ on would be which wavelength they absorb, while emitting. (and clearly reflection has a part in that), but for metal I'd guess that most of the light you see is coming from the surface. I don't think these things are significant enough for your purposes, but maybe they are, i'd need to check. doesn't Wikipedia have this stuff?12-Jan-09 8:43
64GabrieleI'm not entirely sure about that. The emitted light wavelength depends on the temperature only on first approximation. the "room temperature color" is reflected light, which has nothing to do with the emitted light. Of course there are other variables, but I don't see them significant in this case.12-Jan-09 8:40
63AntonNo, just grading hue by itself is not enough to qualify as "scientific data" for me :) You understand that different materials have different colours at different temperatures. As gold and steel cool down from hot white, they must pass through various colours and brightnesses before returning to their normal room temperature colours. This "cooling colour signature" varies from material to material, obviously. That's what I meant. But anyway, I'm likely to get further using my "artistic eye" than searching for such data.11-Jan-09 11:15
62GabrieleMy point is that "hue" is that "scientific data", that is, light wavelength. artistic eye is a different matter though.11-Jan-09 8:36
61AntonAha, that gives me a lead to follow, thanks jocko.10-Jan-09 13:49
60jockoWhy not use the Matlab palettes. They are matrices of 256 colors ( RGB values), with different themes (spectrum, fire, jet, autumn, copper). You could retain only a small subset of them.10-Jan-09 13:41
59Anton.. of course - Hue helps. I was sort of hoping for a palette that was maybe generated from scientific data, or an artistic eye. I was hoping to locate a website with palettes for different metals etc. Someone out there must be doing it. Just trying to locate such information is difficult because coming up with specific enough search keywords is hard in the sea of information about colour. But never mind, never mind, I can do it myself - I think it's faster :)10-Jan-09 12:08
58GabrieleAnton, isn't the H in HSV what you wanted indeed? The actual real life colors...10-Jan-09 8:56
57AntonThanks guys, I know about the hsv-rgb conversion functions, and the interpolation can be improved using them, but I really wanted to improve the colours specified in the COLORS block. That means I'm looking for palettes of ~6 colours which aim to define a colour range like that of cooling metal "in the real world". But never mind, while it looks really cool to use a range of 6 colours, I'm now more of the opinion that it confuses the user interface too much - so I've now using a simple 2-colour range ! Thanks Chris for a look at your code.10-Jan-09 2:26
56Chrishttp://ross-gill.com/r/arrow-style.r8-Jan-09 14:00
55ChrisI have a white-to-color function 'make-wash-table here. Principle would be similar, I guess...8-Jan-09 14:00
54Chris'hsv-to-rgb and 'rgb-to-hsv are in 2.7.68-Jan-09 13:57
53HenrikR3 has some RGB<>HSV<>HSB code as mezzanine. Perhaps it can be backported to R2.8-Jan-09 8:15
52Tomcusing HSV it is trivial to divide your start and end points into as many steps as you need8-Jan-09 6:20
51TomcI made a RGB<->HSV back in the dawn of time I think newer rebols have it built in8-Jan-09 6:19
50AntonHi, I'm looking for a range of colours from "hot white" to "cool blue" to represent molten metal cooling down. Currently I have this range of 6 colours:

colors: [white yellow orange red purple navy]

(I interpolate between the colours for more resolution.) Does anybody know how I can improve these colours ? Any websites that are good for this?

8-Jan-09 3:48
49Rebolekpress "Open" to see some presets11-Jul-08 17:48
48RebolekIt's nothing special, but it works :)11-Jul-08 17:48
47Rebolekhttp://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=texture-lab.r11-Jul-08 17:47
46ReichartLook towards people in the video game business....they did lots of this in the 80-90s11-Jul-08 17:40
45GeomolOr know of a good place to look for texture producing algorithms?9-May-08 16:41
44GeomolHas anyone got experience with this Texturing Tool? http://www.mapzoneeditor.com/index.php9-May-08 16:40
43Rebolekyou're welcome :)20-Aug-07 13:12
42RobertI will play around with this.20-Aug-07 8:28
41RobertThx a lot!! :-)20-Aug-07 8:28
40RebolekREBOL []

colors: [ ; 7 primary colors bn-green 0.102.76 green-field 51.133.110 reed-green 102.163.146 patina-green 153.194.183 glass-green 204.224.219 light-green 232.241.239 ash-gray 209.209.209

; 7 secondary colors midnight 0.29.43 foggy-morning 31.93.154 hazy-day 102.154.204 light-mint 154.204.205 terra-cotta 205.153.103 desert-sand 229.201.115 sunflower 254.191.0 ]

change-colors: func [val /local h hsv][ forskip colors 2 [ hsv: rgb-to-hsv colors/2 h: hsv/1 + val // 255 hsv/1: h colors/2: hsv-to-rgb hsv ] ~b1/color: colors/bn-green ~b2/color: colors/green-field ~b3/color: colors/reed-green ~b4/color: colors/patina-green ~b5/color: colors/glass-green ~b6/color: colors/light-green ~b7/color: colors/ash-gray ~b11/color: colors/midnight ~b12/color: colors/foggy-morning ~b13/color: colors/hazy-day ~b14/color: colors/light-mint ~b15/color: colors/terra-cotta ~b16/color: colors/desert-sand ~b17/color: colors/sunflower ]

lay: layout [ across ~b1: box colors/bn-green ~b2: box colors/green-field ~b3: box colors/reed-green ~b4: box colors/patina-green ~b5: box colors/glass-green ~b6: box colors/light-green ~b7: box colors/ash-gray return ~b11: box colors/midnight ~b12: box colors/foggy-morning ~b13: box colors/hazy-day ~b14: box colors/light-mint ~b15: box colors/terra-cotta ~b16: box colors/desert-sand ~b17: box colors/sunflower return button "change color" [change-colors 64 show lay] ] view lay

20-Aug-07 6:50
39RobertIt's stated that this palette is specialy designed to harmonize. And I want to get a palette being based on blue with the same properties.20-Aug-07 6:33
38RobertThis is my colour palette:

; 7 primary colors bn-green: 0.102.76 green-field: 51.133.110 reed-green: 102.163.146 patina-green: 153.194.183 glass-green: 204.224.219 light-green: 232.241.239 ash-gray: 209.209.209

; 7 secondary colors midnight: 0.29.43 foggy-morning: 31.93.154 hazy-day: 102.154.204 light-mint: 154.204.205 terra-cotta: 205.153.103 desert-sand: 229.201.115 sunflower: 254.191.0

20-Aug-07 6:32
37ChrisBut now there are native hsv functions...19-Aug-07 19:28
36ChrisI wrote this before HSV functions were added to /View, but it still works: http://www.ross-gill.com/r/hsv-lab.r19-Aug-07 19:24
35RebolekRobert, convert your colors to HSV and change Hue.19-Aug-07 16:44
34ChrisWhat does your colour palette look like? e.g. [0.0.100 5.8.189] ?19-Aug-07 16:25
33RobertHi, I have a question concerning color palette conversions.

I have a color palette of greens that I would like to convert to blue using the same "look and style" as the green ones. Is this possible?

19-Aug-07 7:13
32Steevesorry17-Feb-07 2:07
31Steeveby lists, i mean, block of values17-Feb-07 2:07
30Maxim(did you see the !Liquid group on the left?17-Feb-07 2:07
29Steevewell, can you synchronise lists or only single values17-Feb-07 2:07
28Steeve(that's not my question)17-Feb-07 2:06
27Maximmoving to liquid group...17-Feb-07 2:06
26Steeveit's your work isn't it ?17-Feb-07 2:05
25Maximyes?17-Feb-07 2:05
24Steevebtw, i have a question on liquid17-Feb-07 2:05
23Steevedifferent concept17-Feb-07 2:04
22Steevehum ok, it's more advanced than my try17-Feb-07 2:04
21Maximthe layers will allow us to optimise what gets refreshed and allow us to stack some properties of all graphic elements on the same layer, even if the graphic elements themselves are rendered as a list (of overlapping things)17-Feb-07 2:03
20Steevei try17-Feb-07 2:02
19Maximdo read http://www.pointillistic.com/open-REBOL/moa/steel/retools/download/regraph.r17-Feb-07 2:02
18Maximit was just a graphic editing engine proof of concept for my dataflow engine... of which I am now building the v2 of the graphic engine, which allows your graphic elements to render into parrallel layers.17-Feb-07 2:01
17Steeveon rebol.org ?17-Feb-07 1:59
16Steevedon't remember17-Feb-07 1:58
15Steevei'm not sure17-Feb-07 1:58
14Maximdid you try out regraph demo?17-Feb-07 1:58
13Steeveok17-Feb-07 1:58
12Maximboth scripts on rebol.org17-Feb-07 1:58
11Steevedemo-ay ?17-Feb-07 1:57
10Maximbtw steeve tried your little demos... nice17-Feb-07 1:57
9Steevesomeone tried to adapt FFT on Rebol ?17-Feb-07 1:56
8Maximbtw, 'SEGMENT also supports none! which effectively returns that argument's postion, usefull to make segments which reach one of both ends of a line.14-Feb-07 19:32
7Maximhere is segment... a cousin to between which returns two coordinates at one... usefull to draw segments of a bigger line in other colors (handles for example)

;-------------------- ;- segment() ;-------------------- segment: func [ {compute the specified segment from the line} start [pair!] end [pair!] from [decimal! integer! none!] to [decimal! integer! none!] /local vector points length ][ ; solve "degenerate case" first if equal? start end [return reduce [start start]] vector: end - start length: vlength vector ;---------- ; FROM if integer? from [ ; convert from to decimal from: from / length ] if none? from [ from: 0 ] if negative? from [ ; this case lets us define a segment using the end as the reference from: 1 + from ; from is negative, so this actually substracts from length ] ;---------- ; TO if integer? to [ ; convert to, to decimal to: to / length ] if none? to [ to: 1 ] if negative? to [ ; this case lets us define a segment using the end as the reference to: 1 + to ; to is negative, so this actually substracts from length ] reduce [start + to-pair reduce [to-integer vector/x * from to-integer vector/y * from] start + to-pair reduce [to-integer vector/x * to to-integer vector/y * to] ] ]

14-Feb-07 19:30
6Maximthis is my final function, I removed the rounding as it created a lot of noise in position, (not the fault of the round function but the act or rounding itself, would snap the position back and forth while dragging)

I also use the vector's length using an hypothenuse formula (similar to distance), cause your previous example did not properly scale to the vector's maximum size.

I also added support for supplying a negative value for 'AT argument so that it actually offsets from the end, which is very usefull.

vlength: func [v] [v: v * v square-root v/x + v/y]

between: func [ {compute the specified point on the line} start [pair!] end [pair!] at [decimal! integer!] /local vector points ] [ ; solve "degenerate case" first if equal? start end [return start] vector: end - start if integer? at [ ; convert AT to decimal at: at / (to-integer vlength vector) ] if negative? at [ at: 1 + at ] start + to-pair reduce [to-integer vector/x * at to-integer vector/y * at] ]

14-Feb-07 19:28
5Maximthanks I'll test it out shortly ! :-D13-Feb-07 19:10
4Ladislavhow about this?

between: func [ {compute the specified point on the line} start [pair!] end [pair!] at [decimal! integer!] /local vector points ] [ ; solve "degenerate case" first if equal? start end [return start] vector: end - start if integer? at [ ; convert AT to decimal points: max abs vector/x abs vector/y at: at / points ] start + to pair! reduce [round vector/x * at round vector/y * at] ]

13-Feb-07 17:08
3Maximactually the AT argument could be negative or larger than 1 (which indicates points beyond coords) and should also support an integer! , which would change the measure of 'AT to be pixels, instead of a scaling.13-Feb-07 15:58
2Maximdoes anyone have a fast function which will give me (any) point along the line which goes from one coord to another?

X---------(o)---X

the func spec would be:

between [start [pair] end [pair] at [decimal!] ]

where 'at is a decimal ranging from 0 to 1

13-Feb-07 15:55
1MaximLADISLAV POSTED THIS in rebgui group:

this DISTANCE? version looks twice as fast as the one currently distributed:

distance?: make function! [ "Returns the distance between two points." p1 [pair!] "First point" p2 [pair!] "Second point" ][ p1: p1 - p2 p1: p1 * p1 square-root p1/x + p1/y ]

13-Feb-07 15:51

Return to Index Page