|
Post by scalion on Mar 15, 2023 15:06:31 GMT 1
$Library "gfawinx" $Library "UpdateRT" $Library "Direct2D" UpdateRuntime ' Patches GfaWin23.Ocx
FullW 1 Global Double a, b, c, dx, dy, dz, dt, x, y, z, xp, zp Global Double cx, cy, sturn, cturn, aturn Type XYZ_STRUCT - Double x, y, z EndType Global Long i, PCount = 0, Pmax = 20000, ITER = 3000 Global Dim p(Pmax) As XYZ_STRUCT Global Object win1RT Set win1RT = D2GetRT(Win_1) cx = _X / 2 cy = _Y / 2 a = 10 b = 28 c = 8 / 3 x = 0.1 dt = 0.01 Global Double zoom = 5 Do D2BeginDraw win1RT, D2C_Black aturn += 0.01 sturn = Sin(aturn) cturn = Cos(aturn) x = (Rnd - 0.5) y = (Rnd - 0.5) z = (Rnd - 0.5) D2ForeColor = D2C_White For i = 1 To ITER dx = dt * (a * (y - x)) dy = dt * (x * (b - z) - y) dz = dt * (x * y - c * z) x = x + dx y = y + dy z = z + dz PCount = (PCount + 1) % Pmax p(PCount) = XYZ(x, y, z) Next i D2Transform D2TF_ROTATE, Frac(Timer / 100) * 360, cx, cy For i = 0 To Pmax - 1 xp = cturn * p(i).x + sturn * p(i).z zp = cturn * p(i).z - sturn * p(i).x D2Plot cx + xp * zoom, cy + p(i).y * zoom Next i D2EndDraw PeekEvent Loop Until Me Is Nothing Function XYZ(x, y, z) As XYZ_STRUCT XYZ.x = x XYZ.y = y XYZ.z = z EndFunc Sub Win_1_MouseWheel(Buttons&, Delta%, MseX%, MseY%) If Delta < 0 zoom = Max(0.1, zoom / 1.1) Else zoom = Min(50, zoom * 1.1) EndIf EndSub
|
|
|
Post by (X) on Mar 15, 2023 15:10:06 GMT 1
Looks like merging galaxies...
|
|
|
Post by scalion on Mar 15, 2023 18:21:14 GMT 1
I watched the first episode of the "foundations" series based on Isaac Asimov's novel and that's what started me developing this little demo. Indeed when Gaal Dornik triggered Harry Seldon's polyhedron I seemed to have recognized that one...
Try this version with beta modifier (MouseY) and see the beauty of this formula !
|
|
|
Post by (X) on Mar 16, 2023 13:58:17 GMT 1
Foundation season 2: summer 2023. Can't wait!
|
|
|
Post by scalion on Mar 16, 2023 14:40:51 GMT 1
Foundation season 2: summer 2023. Can't wait! Me too !
|
|
|
Post by ventilo25 on Mar 17, 2023 15:49:38 GMT 1
Merci Scalion pour ce bel exemple, le rendu du volume en déplaçant la souris est splendide ! Pourrait-on imaginer une version stéréoscopique anaglyphe (bleu-rouge) avec deux images légèrement décalées sur le même fond noir ?
|
|
|
Post by scalion on Mar 17, 2023 20:22:55 GMT 1
Merci Scalion pour ce bel exemple, le rendu du volume en déplaçant la souris est splendide ! Pourrait-on imaginer une version stéréoscopique anaglyphe (bleu-rouge) avec deux images légèrement décalées sur le même fond noir ? Oui je peux le faire en opengl si tu veux, d'ailleurs je vais m'y mettre.
Edit :
Avant de poursuivre, peut-tu me dire si cette stéréoscopie anaglyphe est fonctionnelle (je n'ai pas de lunettes bleu-rouge sous la main) J'ai donc opté pour les couleurs rouge et cyan
Il faut certainement faire des réglages sur ces variables :
ecartement = parallaxe (ou disparité) j'ai mis 5 au hasard
CouleurOeilDroit = &HFF0000FF, CouleurOeilGauche = &HFFFFFF00 SizeParticule = 20
Il faut tester les 2 modes de fusion des images (dans la procédure Gl_BeginDraw)
soit glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) ' <- Transparancy soit glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA) ' <- Cumulative
Et l'angle de vue (actuellement 95) toujours dans Gl_BeginDraw
gluPerspective(95, Max(1, w) / Max(1, h), 0.1, 2000)
Un dernier paramètre étant la texture utilisée. Il faut regarder dans procédure CreationTexture
Tu peux modifier la taille du point central avec "If d < 0.7"
Et la visibilité du halo autour avec d = (lx * lx + ly * ly) ^ (1 / 20) (en modifiant 1/20 par 1/10 par exemple)
Je te laisse faire des tests, j'attend ton retour d'expérience.
|
|
|
Post by ventilo25 on Mar 18, 2023 17:50:10 GMT 1
Bonjour Scalion, merci beaucoup pour ta réponse. je viens de tester ton programme avec des lunettes rouge-cyan sur monture en carton (les plus courantes car il existe d'autres paires de couleurs) et ça marche magnifiquement ! l'effet de relief et d'espace est déjà là et je n'ai pas encore modifié les paramètres ni le mode d'association des deux images. Je vais le faire cette semaine et je te donnerai des nouvelles. www.123couleurs.fr/explications/explications-vision/tv-anaglyphes/
|
|
|
Post by rogercabo on Mar 19, 2023 22:17:57 GMT 1
I added colors to the points:
But I got an Access Violation 5 at Set win1RT = D2GetRT(Win_1)
And the function D2BeginDrawBlur win1RT, 5 : D2EndDrawBlur doesn't exist
No idea why this happen.
$Library "gfawinx" $Library "UpdateRT" $Library "Direct2D" UpdateRuntime ' Patches GfaWin23.Ocx
Global Double a, b, c, dx, dy, dz, dt, x, y, z, xp, zp Global Double cx, cy, sturn, cturn, aturn Type XYZ_STRUCT - Double x - Double y - Double z - Long color EndType
Global Long i, PCount = 0, Pmax = 20000, ITER = 3000 Global Dim p(Pmax) As XYZ_STRUCT
Global Object win1RT
Set win1RT = D2GetRT(Win_1) cx = _X / 2 cy = _Y / 2 a = 10 b = 28 c = 8 / 3 x = 0.1 dt = 0.01 Global Double zoom = 5
Do D2BeginDraw win1RT, D2C_Black D2BeginDrawBlur win1RT, 5 aturn += 0.01 sturn = Sin(aturn) cturn = Cos(aturn) x = (Rnd - 0.5) y = (Rnd - 0.5) z = (Rnd - 0.5) For i = 1 To ITER dx = dt * (a * (y - x)) dy = dt * (x * (b - z) - y) dz = dt * (x * y - c * z) x = x + dx y = y + dy z = z + dz PCount = (PCount + 1) % Pmax p(PCount) = XYZ(x, y, z, RGB(255 * Abs(x * 0.05), 255 * Abs(y * 0.05), 255 * Abs(z * 0.05))) Next i D2Transform D2TF_ROTATE, Frac(Timer / 100) * 360, cx, cy For i = 0 To Pmax - 1 xp = cturn * p(i).x + sturn * p(i).z zp = cturn * p(i).z - sturn * p(i).x D2ForeColor = p(i).color D2Plot cx + xp * zoom, cy + p(i).y * zoom Next i D2EndDrawBlur D2EndDraw PeekEvent Loop Until Me Is Nothing
Function XYZ(x, y, z, color) As XYZ_STRUCT XYZ.x = x XYZ.y = y XYZ.z = z XYZ.color = color EndFunc
Sub Win_1_MouseWheel(Buttons&, Delta%, MseX%, MseY%) If Delta < 0 zoom = Max(0.1, zoom / 1.1) Else zoom = Min(50, zoom * 1.1) EndIf EndSub
|
|
|
Post by scalion on Mar 20, 2023 8:37:45 GMT 1
Lol, RogerCabo, it's a joke ? Or maybe you are very tired ? Well, if you open a window like "Fullw 1" before you call "Set Win1Rt=D2GetRT(Win_1)" that eliminate the Access Violation x00000005 And D2EndBlur  What 's that ?  You have an extended library ? I've just commented the ....blur function and open the windows with your code, that's work :
Now certainly you want to implement a blur function.
Try this tip : ' D2BeginDraw win1RT, D2C_Black ' <-Replace this ' By this -V D2BeginDraw win1RT D2PBox 0, 0, _X, _Y, D2Brush(ARGB(10, 0, 0, 0)) ' Clear the screen with a transparency color keep traces
|
|
|
Post by scalion on Mar 20, 2023 10:24:26 GMT 1
Now i finished my "Lorentz Attractors" implementations, This was a little recreational break, my obsession for this formula is satisfied, thank you for giving me the idea of an anaglyph vision of this fabulous mathematical object. I'm going back to my other projects, I'm happy to see that everyone is still there, still fully motivated, I'll probably be back soon.
Here is the passage from episode 1 of season 1 of "foundations" that got me into this story of attractors (https://www.youtube.com/watch?v=fxh12VX-GRE)...
|
|
|
Post by (X) on Mar 20, 2023 12:37:33 GMT 1
You knocked it out of the parc!
Bravo!
|
|
|
Post by scalion on Mar 20, 2023 14:37:57 GMT 1
You knocked it out of the parc!
Bravo!
How my god, i'v do a mistake...
Big mistake : p(i)=... never start on the good point Now it's p(ParticuleATraiter) = ... I anderstand now why i can't reached some shapes.
This new version work better (i hope it's the last) :
|
|
|
Post by rogercabo on Mar 21, 2023 17:28:47 GMT 1
Ne t'inquiète pas de tes erreurs maintenant.. tant que tu n'as pas atteint 500 publications (mode DIEU), tu es excusé(e) !  Anyway great stuff! Oh I understand this trick. I think it's time based and the command should be previous all draw_points to prevent darkening the scene. >> D2PBox 0, 0, _X, _Y, D2Brush(ARGB(10, 0, 0, 0)) ' Clear the screen with a transparency color keep traces
|
|
|
Post by ventilo25 on Mar 22, 2023 21:48:18 GMT 1
Oh c'est splendide ! La version anaglyphe est tout à fait extraordinaire, spécialement quand on est dans le plan des particules qui sortent littéralement de l'écran. Avec en plus tous les paramètres sur le côté, c'est super pratique. Bravo et merci pour ce bijou de maths spatiales. ------------------------------------ Oh that's splendid! The anaglyph version is quite extraordinary, especially when you are in the plane of the particles literally coming out of the screen. With all the parameters on the side, it's super convenient. Bravo and thank you for this gem of space math.
|
|
|
Post by scalion on Apr 6, 2023 7:31:31 GMT 1
Oh c'est splendide ! La version anaglyphe est tout à fait extraordinaire, spécialement quand on est dans le plan des particules qui sortent littéralement de l'écran. Avec en plus tous les paramètres sur le côté, c'est super pratique. Bravo et merci pour ce bijou de maths spatiales. ------------------------------------ Oh that's splendid! The anaglyph version is quite extraordinary, especially when you are in the plane of the particles literally coming out of the screen. With all the parameters on the side, it's super convenient. Bravo and thank you for this gem of space math. Jettes un oeil ici ca va te plaire je pense : threejs.org/examples/#webgl_effects_anaglyph
|
|
|
Post by (X) on Apr 6, 2023 12:24:52 GMT 1
|
|