3dreamengine / 3DreamEngine

3DreamEngine is an *awesome* 3d engine for LÖVE.
MIT License
393 stars 17 forks source link

love-loader #5

Closed thisnickwasfree closed 4 years ago

thisnickwasfree commented 4 years ago

Is it possible to load textures through love-loader?

Luke100000 commented 4 years ago

all textures inside the material (tex_albedo, ...) can be pathes (will use the 3Dream loader) or the actual image. A integration should therefore be possible. Has the inbuilt loader any problems?

thisnickwasfree commented 4 years ago

Has the inbuilt loader any problems?

Only one: other resources (not for 3dreamengine) are loading through another preloder. And two (pre)loaders at one time — is it a good idea?

Luke100000 commented 4 years ago

The 3Dream loader supports lag free loading (even with high res textures), if required. If both loaders are active and you dont manually check they might execute a loading step at the same time and cause a slightly higher lag. But in general there is no problem having two. But yes, you can just load the textures yourself/ via another loader.

thisnickwasfree commented 4 years ago

Hm, may be we are talking about different things… I mean PREloader: percentage of loading for making screen-indicator and callback, telling «all done» and allowing to call/load another game state. So I can show a loading screen to a player and show him even heavy (for love2d) scene only when it completely loaded.

Luke100000 commented 4 years ago

oh ok now I understand. Iterate over all objects, replace the path (if present) in object.material.tex_albedo, tex_emission and tex_normal with the actual image. The only thing which will fail is the combined texture (to increase performance glossiness, specular and ambient occlusions are combined into one texture automatically, threaded, in the background)

That means you need to copy that from the temporary output folder (inside the appdata directory "combined") and load it into object.material.tex_combined. Or you ignore it but then it will use the 3Dream loader.

thisnickwasfree commented 4 years ago

replace the path (if present) in object.material.tex_albedo, tex_emission and tex_normal with the actual image Is it possible to replay the path to texture with a variable? For example, I load files with love-loader and can draw them later giving the renderer elements of lua-table. And if yes: should use I 3dreamengine .mat file for this, not .mtl?

Luke100000 commented 4 years ago

.mat is in my opinion better because it represent the structure as it is at runtime, .mtl support is mainly for blender/3D software export. And you can change those variables anytime, except between prepare() and present() as this may cause errors. However keep in mind that glossiness, roughness and ambient occlusion has to be one texture. I might add a shader which supports seperate images but I do not recommend this. Everything is fine as long as the texture is either a valid path, a valid texture, (an instruction for the image worker thread, ignore this one) or nil, in which case it uses an empty texture.

thisnickwasfree commented 4 years ago

Well, using link to a texture loaded by third party returns the error: loader.lua 277 (custom = custom and custom:match("(.+)%..+") or custom) No match method. Or something like this. I want to use links like media.images.texture in .mat files. tex_albedo = media.images.texture, for example. And media.images.texture is a graphical data, loaded by love-loader. Is it posiible?

Luke100000 commented 4 years ago

Well, using link to a texture loaded by third party returns the error: loader.lua 277 (custom = custom and custom:match("(.+)%..+") or custom) No match method. Or something like this. I want to use links like media.images.texture in .mat files. tex_albedo = media.images.texture, for example. And media.images.texture is a graphical data, loaded by love-loader. Is it posiible?

This should work fine and is an error on my side, I will fix it soon. Thanks for reporting.