Could you tell the person who wants to study and create new 3d fractals for mb3d, where to begin learning, theory and practice?
You're probably in the right place (Fractal Forums), if you don't have access to courses on the applied mathematical arts and programming at your school.
I learned by experimentation, asking questions, looking at things others did. As you gain experience / knowledge, the things that others are talking about (raytracing, vectors, mathematical concepts, etc.) will begin to make more sense to you.
But I think you just want to know how to code a formula for M3D so that it works, right?
Thargor6 released a beta version with a JIT compiler, so you'll be able to write formulas in Delphi (I think there are examples in one thread- you can use the forum's search function to find it), I think the JIT compiler might be included with the new release that is coming out before Christmas. Using the JIT would probably be a LOT easier than hard coding in assembly! However, it's 1/2 as fast (rendering times) for whatever reason. Andreas might or might not have fixed that. We can always hard code any really cool fractals later.
Otherwise, you'll need to do something like the following:
1) Download OllyDbg http://www.ollydbg.de/ unless you use something else to disassemble and reassemble code
2)
If your disassembler needs an executable file to work on, open one, if you don't have to open a file, don't bother doing it. Open up an executable file in OllyDbg to use as a scratch pad (don't save whatever file you use as a scratch pad when you're done with it! You don't want to corrupt the file!). DarkBeam likes to use twunk32.exe (a file in the windows/system directory, I believe). I assembled a "hello world.exe" in some compiler and use that.
3) open a simple formula (like _abs_3d.m3f) from the M3D formula's directory in Notepad or equivalent text editor
4) highlight and <Ctrl-c> copy the CODE portion of the formula
5) Highlight a bunch of zeros in OllyDbg, then binary paste (right click menu) the code of the formula
6) I like to paste the disassembled code into notepad to work on...
7) Match the math in the formula's description to the assembly code. You can Google assembly commands. Art of assembly is a good reference for 8086 assembly...
Change the assembly code and math to something else that makes sense (you can't write random characters...
[OPTIONS]
.Version = 2
.DEoption = -1
.Double Scale = 1.0
.Double fixX = 0.0
.Double fixY = 0.0
.Double fixZ = 0.0
[C0DE] // O replaced with 0 to keep it from.. mehh... ;)
558BEC56538B75088BD88B7630DD03D9
E1DC4EF0DC46E8DD1BDD02D9E1DC4EF0
DC46E0DD1ADD01D9E1DC4EF0DC46D8DD
198BC35B5E5DC20800
[END]
Description:
x' = abs(x)
y' = abs(y)
z' = abs(z)
(x',y',z') *= Scale
(x',y',z') += fixVec
Disable Analytical DE to see the effect correctly.
00401033 55 PUSH EBP
00401034 8BEC MOV EBP,ESP
00401036 56 PUSH ESI
00401037 53 PUSH EBX
00401038 8B75 08 MOV ESI,DWORD PTR SS:[EBP+8]
0040103B 8BD8 MOV EBX,EAX
0040103D 8B76 30 MOV ESI,DWORD PTR DS:[ESI+30]
//before here is initialization- loading parameters, saving them for later,etc.
//the following does the abs (absolute value |-1| = 1, |1|=1) , scaling (*Scale), and translation (+fixVec)
00401040 DD03 FLD QWORD PTR DS:[EBX] // EBX is generally the x variable
00401042 D9E1 FABS
00401044 DC4E F0 FMUL QWORD PTR DS:[ESI-10] // this particular formula
// uses the ESI register for user defined variables, some use EDI, etc.
// Variables start at -10, and for doubles (integers are shifted by 4 bytes), the next one will be
// -18, then the next -20, the -28.... 10 is hexadecimal, which means it is actual 16,
// 18h=24d, 20h = 32d... etc.
// user defined [CONSTANTS] are also saved in ESI (or EDI, or wherever), but start at
// ESI, then shift by the variable type size (so if the first one [ESI] is a double, the next will
// be 8 away [ESI+8], if [ESI+8] is an integer (takes up 4 bytes), the next will be at [ESI+C]
// (Ch=12d)
// I'll have to find it, but there is a reference that lets you know offsets of various data in
// M3D... I'll post it in the thread I make. which is this thread if you're reading this.
// List is in next code block below.
00401047 DC46 E8 FADD QWORD PTR DS:[ESI-18]
0040104A DD1B FSTP QWORD PTR DS:[EBX]
0040104C DD02 FLD QWORD PTR DS:[EDX] //EDX is generally the y variable
// if you want to remove one absolute value from the code, delete a "D9E1" from the [c0de] block:
0040104E D9E1 FABS
00401050 DC4E F0 FMUL QWORD PTR DS:[ESI-10]
00401053 DC46 E0 FADD QWORD PTR DS:[ESI-20]
00401056 DD1A FSTP QWORD PTR DS:[EDX]
00401058 DD01 FLD QWORD PTR DS:[ECX] // ECX is generally the z variable
0040105A D9E1 FABS
0040105C DC4E F0 FMUL QWORD PTR DS:[ESI-10]
0040105F DC46 D8 FADD QWORD PTR DS:[ESI-28]
00401062 DD19 FSTP QWORD PTR DS:[ECX]
//after this, we restore the parameters we saved during initialization
00401064 8BC3 MOV EAX,EBX
00401066 5B POP EBX
00401067 5E POP ESI
00401068 5D POP EBP
00401069 C2 0800 RETN 8
The offsets below are in decimal, not hex! -48d = -30h You'll
J4: Double; //-56 4d extension FastMove(dJUx, It3Dex.J1, 168);
Rold: Double; //-48 used by m3d, equals Rout
RStopD: Double; //-40 used by m3d for sse2, not always a valid value in here, in IFS: absDEstop
x: Double; //-32 vector to iterate -120 in dIFS esi
y: Double; //-24
z: Double; //-16
w: Double; //-8
C1, C2, C3: Double; //0 input start values before 4d rotation, C4 is 0. Do Not Change!
J1, J2, J3: Double; //+24 julia start values or the pixelpos, these are the constants to add
PVar: Pointer; //+48 pointer to the user input values (decreasing offset, -8 is always val 0.5)
//+ constants (incr. offset, 0 and above)
SmoothItD: Single; //+52
Rout: Double; //+56 the square of the current vector length, calced in m3d, in dIFS: rel DEout
ItResultI: Integer; //+64 integer iteration count, increased by loop function in m3d
maxIt: Integer; //+68
RStop: Single; //+72 for dIFS: bool for insiderendering -> DEcomb with usual bulb needs RStop!!