Iron is a 3D engine core library built with Kha and Haxe. Powering Armory.
armory3d / iron Goto Github PK
View Code? Open in Web Editor NEW3D Engine Core
Home Page: https://github.com/armory3d/iron/wiki
License: zlib License
3D Engine Core
Home Page: https://github.com/armory3d/iron/wiki
License: zlib License
First of all: this is more like a missing feature than a bug.
When using applyForce()
(Documentation) on rigid body objects, the second parameter loc
of that function works like an offset in world coordinates, but the rotation of the object is not taken into account.
I know that loc
probably stands for "location" and not for "local", but for me it makes way more sense to use the second parameter as an offset from the object that isn't using world coordinates but local coordinates. In most cases, the second parameter is used to describe a position at the game object the force is applied to, so it should take in a vector in local space (offset from the objects center) and respect the object's rotation.
If the input is (1, 0, 0, 0)
(= apply the force 1 unit left of the object's origin), it should always be left of the origin regardless of the rotation of that object. Currently, if you rotate the object 90 degrees left on the z axis, the force will be applied at the front of the object.
So as a workaround, you need to rotate every point with the object's rotation to get a relative position vector that properly works with applyForce()
.
`Compiling shader 8 of 8 (painter-video.vert.glsl).
C:\Users\blake\Downloads\Armory3D\Armory\armsdk\iron\Sources/iron/data/Geometry.hx:165: characters 2-15 : Unknown identifier : buildVertices
Haxe compiler error.
Build failed, check console
`
The if state is preventing the function from being defined, which is referenced by the copyVertices function.
#if (!arm_deinterleaved)
I moved the copyVertices function within the above if statement but copyVertices is being referenced in another file. I just removed the if statement for now.
After building a working project for HTML5 a few times, eventually the build will not run and the web console will have this error:
Firefox: "Error: <unknown>"
Chrome: "Uncaught Error kha.js:2064"
haxe_Unserializer.unserialize @ kha.js:2064
haxe_Unserializer.run @ kha.js:1804
kha_StorageFile.readObject @ kha.js:6075
zblend_sys_Storage @ kha.js:14149
$extend.loadingFinished @ kha.js:11507
f @ kha.js:15975
kha_Loader.checkComplete @ kha.js:4578
(anonymous function) @ kha.js:4468
$extend.loadBlob.request.onreadystatechange @ kha.js:8953
The issue appears to be related to Logic Nodes. I had a Vector with a value in y plugged into a Transform node. That worked fine. Once I added a value to x as well as y, then the errors above happened. Once that error happens, you can't reverse it. I tried setting the vector x back to 0, deleting the nodes, deleting the 'Nodes' trait from the object, deleting the Object. Nothing worked.
Would PBR (Physically-Based Rendering) materials be something that is possible to do in zBlend, or is that something that would first need to be supported by Kha?
Following the installation instructions at http://zblend.org/docs/ I found an error. When I hit the Start button under the zblend_start section, I get an error saying that the file ./Libraries/zblend/blender/zblend_assets.py does not exist.
This was running with Blender 2.74 under 64bit Windows 8.1
The link to iron_format in the wiki is broken.
- iron_format for 3D model import
That said, does iron_format still exist? I couldn't find it under armory's repositories
iron/Sources/iron/object/Object.hx
Line 155 in 3153959
getTrait()
should cast super classes as-well?
Armory scenario:
A Character that inherits NavAgent will make GoToLocationNode not match because looks for armory.trait.NavAgent
.
I understand that there are probably performance impact by doing it.
Is this issue actually in the wrong place and should by posted in armory itself?
Perhaps it just requiere add extra attribute to choose extra class name to check when GoToLocationNode?
When I try to build the source files of a project in Visual Studio 13 for Win32 it gives 8 errors (on all examples and new blender projects):
error C2719: 'v': formal parameter with __declspec(align('16')) won't be aligned
When I try with x64 build it gives no errors, but it just show's an empty gray screen.
When I build from console with node Kha/make windows it gives some warnings.
my_project\build\temp\mesh.frag.hlsl(68,21): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
Kha Samples without zblend are working with Win32 and x64.
Hi Lubos, it's been a while since I tried your project (I like the new name by the way, easier to search for) I tried to run the my_project.blend in HTML5 and all I saw was a grey screen. Eventually, I figured out it was the inside of the default cube I was looking at. I had to move the Box a little further out to see it fully.
It seems that the camera will respect Rotation values but the camera is always at 0,0,0 Position when the game runs even if it's moved somewhere else in Blender.
TL;DR:
Thanks,
Devin
Hello there,
I made some test with object animation and I notice location, scale or rotation can have a NaN
when my animation got repeated values.
For example, if I read myAction.json, I got that for the scale:
{
"curve": "bezier",
"frames": [
1,
60
],
"frames_control_minus": [
-22.034278869628906,
36.965721130371094
],
"frames_control_plus": [
24.034278869628906,
83.0342788696289
],
"target": "zscl",
"values": [
1.0,
1.0
],
"values_control_minus": [
1.0,
1.0
],
"values_control_plus": [
1.0,
1.0
]
}
So here (https://github.com/armory3d/iron/blob/master/Sources/iron/object/ObjectAnimation.hx#L133), when you get frameIndex = 2
, it returns frame 60 and then for frameIndex = 3
it returns undefined
.
I fixed the problem for my project. I did not have enough of time to make a pull request. You can found the gist and the gist diff here
Fix: https://gist.github.com/FuriouZz/5f254e7d433beac368f4fa265e95e0eb
Blend+Video: object_animation.zip
PS: My solution seems to break the interpolation because the if (ti == tii) continue;
=(
Most functions end with a return this
to support call chaining, but not all. Was this by design or just a didn't need it at that time choice?
Hi,
Foxfw looks very interesting. I followed the wiki directions (more or less, other issues), but when eventually trying to run the project I get an error:
Generating Kha project.
../Sources/fox/trait/DaeScene.hx:5: characters 7-31 : Class not found : fox.sys.
importer.DaeData
But I cannot find this class in the Sources repo. (Animation and AnimationClip either)
Is it not available (yet)?
I am quite close to getting Texture test working with Iron but somewhere I am missing a detail, would it be possible to add example ( without .arm or .blend ) that uses texture or perhaps just some advise in regard to my code.
At moment the white shape is where a texture should show up.
https://nanjizal.github.io/Xperimental/trilateralIron/bin/index.html
The texture and mesh are all setup in:
https://github.com/nanjizal/Xperimental/blob/master/trilateralIron/Sources/iron/helper/TextureColorMesh.hx
It works in a similar way to my SingleColorMesh and MultiColorMesh which are also setup in the example, camera works but is currently implemented without lookAt which would also useful to get advise on.
TextureColorMesh is created here:
https://github.com/nanjizal/Xperimental/blob/master/trilateralIron/Sources/Main.hx#L82
Shaders involved
https://github.com/nanjizal/Xperimental/blob/master/trilateralIron/Shaders/painter-image-iron.vert.glsl
https://github.com/nanjizal/Xperimental/blob/master/trilateralIron/Shaders/painter-image-iron.frag.glsl
should only require Trilateral to work so not many dependancies ( TrilateralXtra should not be needed unless I left some imports in ).
I think the uv data is probably fine as I have done similar in Kha see cat in TrilateralBazaar or jigsaw in Xperimental.
It's important that UV's allow short4norm to mirror triangle coordinates for texture masks.
https://github.com/nanjizal/TrilateralXtra/blob/master/src/trilateralXtra/kDrawing/PolyPainter.hx#L352
For instance used in dynamically generated jigsaw, requires multiple changes perhaps introduction of tex4 and uv4 to the code base for this feature to minimize impact on other uses?
I would like to be able to change the number of frames per second, because for web applications and for smartphones 60 frames is a lot (Vsync
- 60 or no limit, it is known).
I studied the source code of the Armory
engine and its abstraction levels (Armory
, Iron
, Kha
) and came to the following conclusions:
Armory
and Iron
;Kha
:render
function that is registered to execute as kha.System.notifyOnFrames()
and will run with a limit of 60. Because it depends on the call event on the chosen platform;update
function to the Scheduler
and you can specify the frequency of more execution. You can specify a value of 30 and it turns out that the scene is render 2 times, and updated 1 time. Because neither are executed in parallel.Display
class (it is located in ArmorySDK\Kha\Backends\[target_name]\kha
), you need to specify a value for the platform in the get_frequency()
function. Or, in the Time
class of the Iron
engine (ArmorySDK\iron\Sources\iron\system
) in the init()
function, specify the frequency value instead of what is there.Can make changes to Iron
:
To make the render
function run with the same frequency as update
, you can register an “empty function” in kha.System.notifyOnFrames()
(only to store the value from the frames[0]
array passed in the framebuffer
field). And execute the real function in update
. In this case, the empty function will still be executed 60 times, but the “workers” will only be 30.
And for the “correct” display of the FPS value in the DebugConsole
and in the Get FPS
node, it is necessary to correct that the time during the calculation was used from Scheduler
, and not the real one (which will produce 60 FPS).
I haven’t been able to find any other way to limit the frames per second other than upgrading the Iron
. In this case, you can display settings in the nodes or the Blender interface. But this is a limitation at the level of one of the abstraction layers. And make it optional, if the user left the FPS limit at 60, then everything will work according to the current algorithm.
The developers Kha
are in no hurry to introduce such a possibility (judging by the topics on the forum (http://forum.kode.tech/topic/329/building-a-desktop-app-render-on-demand) and the request in git (Kode/Kha#320)).
I wrote the results of my searches here (https://forums.armory3d.org/t/set-limit-framerate-ln-for-get-fps/4286/8).
What do you think about this? Is there any other way to solve this problem?
I would like to use just use blender for modeling and do all the coding manually, are there any basic examples of loading and moving a cube which shows the basic project structure?
When building for HTML5, I'm only presented a page that says 'Directory listing for /build/html5/' with a list of files on it...
Also, when I compiled it for Windows, the build/windows folder got a bunch of files in it, but no runnable ones - how do I run the application?
Hi,
How can I add iron
as a dependency to a Kha project? I'm using Kode Studio, but there's unfortunately very little documentation
Hi, I'm trying to have multiple separated circles that co-exist in the same geometry to billboard to the camera to produce caps for this armory3d/armory#810 and emulate the behavior of caps in Blender.
Now the problem is that I can't use the current billboard implementation because it uses the object.transform, so the transformation of each "individual separated parts" that could exist inside a geometry are completely ignored and assumed to be one big mesh.
The easiest solution probably would be to simply separate the circles in multiple objects, but I prefer the more complicated one to save performance and space 😄.
While I was digging the code, I noticed that this non-feature affects mesh culling too and either the whole mesh is culled or not, which leads to what is shown in the picture: an individual sub-mesh (blue sphere) not being culled when it should. So I think this could help mesh culling too.
So I assume having an array of transforms or simply an array of "pivot point" for each individual "sub-mesh" and feed that to the object uniform and the mesh culling could help it.
The problem is, which I was mostly stuck with, how a "sub-mesh" could be defined? Index arrays maybe? That could work if they have different materials, but the "problem" with that is that the exporter groups meshes that share a material for performance reasons. So maybe one way could be to tell the exporter "hey, I want them separated!"?
What do you think @luboslenco? Or do you have any other idea to solve this?.
Doing this http://docs.zblend.org/en/latest/Getting-started/ in MaxOS (10.9.3), Blender (2.71), Haxe (3.1.3), have succesfully fetch, but when press built, get this error in console
Error: Cannot find module './Tools/khamake/khamake.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Volumes/Home HD/Users/alijaya/Desktop/test/Kha/make.js:1:63)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
Would it be possible to implement add a fur shader as a feature in zBlend? I'm not talking the about the customized particle simulation that blender uses, but rather a material or shader that simulates the appearance of fur. The technique is also useful for simulating grass.
An example GLSL fur shader can be found here: https://github.com/sdao/fur-demo
Building and running - for html5 - the start file (test.blend) in Google Chrome and IE gives the following error:
> Uncaught Could not link the shader program | kha.js:13887
But Firefox has no problem at all running the exact same thing...
This also happens with your node-demo you posted on twitter
I don't know if this is a fox only thing, but it is quite recent. Earlier demos - eg. chess - work just fine.
iron/Sources/iron/data/ShaderData.hx
Line 143 in f29640c
iron/Sources/iron/data/ShaderData.hx:143: characters 4-65 : Null<Int> should be kha.graphics4.StencilValue
iron/Sources/iron/data/ShaderData.hx:143: characters 4-65 : Int should be kha.graphics4.StencilValue
There's a bit of a problem with the licensing of zblend. Blender is licensed under the GPL license, and because of this, any plugins written for it are required to be licensed GPL as well. Or has zBlend been implemented in such a way that it doesn't directly use any of blender's code?
If you make more than 1 NodeTree in a zblend .blend file then you will get this error on build:
"Haxe stderr: ..\Sources/Main.hx:10: characters 8-47 : Class not found : my_project.NodeTree.001"
"Haxe process exited with code 1"
Even if you do not use NodeTree.001 anywhere, it will still give that error. Also, renaming NodeTree.001 to something else like "NodeTree2" will still give the error message on build using the old name "NodeTree.001"
thanks to @QuantumCoderQC and @MoritzBrueckner, the issue was pinpointed to this commit e1c49f7
It seems the problem is with those remnants ifs from the refactor
iron/Sources/iron/object/Uniforms.hx
Line 816 in fc1a6a5
I pushed a simple fix which seems to solve the issue, N8n5h@ac2a0ed
But not sure if this is the best solution performance-wise since I'm unfamiliar with how Haxe's switch works.
what do you think @luboslenco ?
Maybe something like
if (c.link.startsWith("_biasLightWorldViewProjectionMatrixSpot")) {
...
} else if (c.link.startsWith("_biasLightViewProjectionMatrixSpot")) {
...
} else {
switch(c.link) {
...
}
}
could be a better solution instead?
Hey... I see some issues here talking about examples, but for zblend (which I assume was an old name for lue)
Are there any current examples anywhere? The stuff you're showing on Twitter looks super cool ;-)
Thanks!
@9987 in discord said:
When I destroy an object in Armory, the same object can execute other actions.
For example, if I do a
On contact with player --> Destroy self --> Spawn explosion
The explosion spawns!
While in another engines, the explosion cannot get spawned because a destroyed object can't execute code
But if I do this:
Event spawn explosion --> Spawn explosion
On contact with player --> Destroy self --> Execute event "spawn explosion"
Then the explosion doesn't get spawned.
Is there a delay or something after an object gets destroyed? Or will the object execute every node that is connected after the Destroy self?
This could have been because at: https://github.com/armory3d/iron/blob/master/Sources/iron/object/Object.hx#L70, the trait is only getting removed from the array but not the main update loop. at that line maybe removeTrait() https://github.com/armory3d/iron/blob/master/Sources/iron/object/Object.hx#L137 could be used.
If you add a "Nodes" trait to the default cube and create a NodeTree for it, the cube will not show up in game (HTML5 build)
In the Browser console of FireFox I get this Warning:
TypeError: asm.js type error: Disabled by javascript.options.asmjs in about:config ammo.js
And this Error:
TypeError: cl is not a constructor kha.js:352:0
I would like to request timescale manipulation in armory. If it is already there, could you please add an example on this ?
Also it would be great if I can make certain objects not affected with timescale changes. For example in Unity I can make certain object not effected when I set the timescale speed to 0. So I can use that objects (pause dialogs) to still play animations and response when user click resume button.
Hello. I'm following this guide: https://github.com/luboslenco/fox/wiki
But on the last step i get these errors in terminal (started blender from command line):
PyContext 'window' not found
PyContext 'window' not found
Generating Kha project.
Exporting asset 1 of 2 (data.json).
fs.js:432
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT, no such file or directory 'Assets/data.json'
at Object.fs.openSync (fs.js:432:18)
at Object.fs.readFileSync (fs.js:286:15)
at Object.exports.copy (/home/alex/temp/foxtest/Kha/Kore/Tools/koremake/Files.js:31:71)
at Exporter.KhaExporter.copyFile (/home/alex/temp/foxtest/Kha/Tools/khamake/KhaExporter.js:22:8)
at Exporter.Html5Exporter.copyBlob (/home/alex/temp/foxtest/Kha/Tools/khamake/Html5Exporter.js:134:7)
at exportAssets (/home/alex/temp/foxtest/Kha/Tools/khamake/main.js:184:12)
at exportKhaProject (/home/alex/temp/foxtest/Kha/Tools/khamake/main.js:263:3)
at exportProject (/home/alex/temp/foxtest/Kha/Tools/khamake/main.js:439:3)
at Object.exports.run (/home/alex/temp/foxtest/Kha/Tools/khamake/main.js:514:2)
at Object.<anonymous> (/home/alex/temp/foxtest/Kha/Tools/khamake/khamake.js:107:22)
This is due to case-sensitive filesystem. After fixing assets folder name i advanced to these errors:
PyContext 'window' not found
PyContext 'window' not found
Generating Kha project.
Exporting asset 1 of 2 (data.json).
Exporting asset 2 of 2 (Scene.ogex).
Assets done.
kfx stderr: Kha/Kore/Tools/kfx/kfx-linux: 1: Kha/Kore/Tools/kfx/kfx-linux: Syntax error: "(" unexpected
kfx stderr: Kha/Kore/Tools/kfx/kfx-linux: 1: Kha/Kore/Tools/kfx/kfx-linux: Syntax error: "(" unexpected
kfx stderr: Kha/Kore/Tools/kfx/kfx-linux: 1: Kha/Kore/Tools/kfx/kfx-linux: Syntax error: "(" unexpected
kfx stderr: Kha/Kore/Tools/kfx/kfx-linux: 1: Kha/Kore/Tools/kfx/kfx-linux: Syntax error: "(" unexpected
kfx stderr: Kha/Kore/Tools/kfx/kfx-linux: 1: Kha/Kore/Tools/kfx/kfx-linux: Syntax error: "(" unexpected
kfx stderr: Kha/Kore/Tools/kfx/kfx-linux: 1: Kha/Kore/Tools/kfx/kfx-linux: Syntax error: "(" unexpected
kfx stderr: Kha/Kore/Tools/kfx/kfx-linux: 1: Kha/Kore/Tools/kfx/kfx-linux: Syntax error: "(" unexpected
kfx stderr: Kha/Kore/Tools/kfx/kfx-linux: 1: Kha/Kore/Tools/kfx/kfx-linux: Syntax error: "(" unexpected
kfx process exited with code 2
kfx process exited with code 2
kfx process exited with code 2
kfx process exited with code 2
kfx process exited with code 2
kfx process exited with code 2
kfx process exited with code 2
kfx process exited with code 2
Haxe stderr: Class not found : Main
Haxe process exited with code 1
Done.
Which i don't know how to workaround since kfx-linux seems to be binary file.
Any ideas?
Also on Linux node
is located at /usr/bin/nodejs
or /usr/bin/node
, not in /usr/locale/bin/node
:)
Not sure if this is a better fit for Kha or Iron, but looks like the latter to me.
VS Code will spit this error when the Haxe Language Server wants to start.
Haxe language server started
Haxe Path: /armsdk/Kha/Tools/haxe/haxe-osx
Using --server-connect
Haxe connected!
Listening on port 6000
Failed - try fixing the error(s) and restarting the language server:
/armsdk/iron/Sources/iron/data/Geometry.hx:222: characters 18-27 : Null<kha.graphics4.VertexBuffer> has no field lockInt16
/armsdk/iron/Sources/iron/data/Geometry.hx:247: characters 27-36 : kha.graphics4.VertexBuffer has no field lockInt16
If this rather should be placed in Kha-issues, please let me know.
Best,
tL.
I also tried to change lockInt16()
to lock()
in Geometry.hx
but then (rather obviously) this happens:
kha.arrays.Float32Array should be kha.arrays.Int16Array
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.