Title: How to code a formula for M3D Post by: M Benesi on December 03, 2015, 07:32:53 PM Quote from: Hidden 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... 8) Change the assembly code and math to something else that makes sense (you can't write random characters... ;) Code: [OPTIONS] The offsets below are in decimal, not hex! -48d = -30h You'll Code: J4: Double; //-56 4d extension FastMove(dJUx, It3Dex.J1, 168); Title: Re: How to code a formula for M3D Post by: DarkBeam on December 03, 2015, 11:09:02 PM Ok Matthew moved it in tutorials section :)
There are other threads here discussing this matter so people can read all :) Title: Re: How to code a formula for M3D Post by: M Benesi on December 04, 2015, 05:29:35 AM k, thanks. Edit the post if you feel like adding to it or fixing anything.
Title: Re: How to code a formula for M3D Post by: cyseal on December 04, 2015, 09:06:56 AM Thanks!
I thought you could write the formula as in Fragmentarium as a text file and save it as .mb3 so that MB3D could render it? Is it possible to write the formula in Codelite and then use it and .mb3 formula? Title: Re: How to code a formula for M3D Post by: DarkBeam on December 04, 2015, 10:57:01 AM You can code it in Pascal using the JIT experimental build. |