Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedded textures can't be retreived #107

Closed
flarive opened this issue Jan 1, 2025 · 3 comments
Closed

Embedded textures can't be retreived #107

flarive opened this issue Jan 1, 2025 · 3 comments

Comments

@flarive
Copy link

flarive commented Jan 1, 2025

Hello,

It seems that embedded textures is not working.

In 3ds max i export my material textures as embedded data in the fbx.
The fbx file is much bigger than the one without embedded data, so textures are correctly stored in my fbx.

max_export_embedded_textures

Using scene->getEmbeddedDataCount() or texture->getEmbeddedData() always returns me nothing.

In your code you seems to only consider videos as possible embedded data, right ?
Textures impages can also be embedded in the fbx.

int getEmbeddedDataCount() const override {
     return (int)m_videos.size();
}

DataView TextureImpl::getEmbeddedData() const {
	if (!media.begin) return media;
	for (const Video& v : scene.m_videos) {
		if (v.media.end - v.media.begin != media.end - media.begin) continue;
		const size_t len = v.media.end - v.media.begin;
		if (memcmp(v.media.begin, media.begin, len) != 0) continue;

		return v.content;
	}
	return {};
}

Thank for your help

Eviral

@nem0
Copy link
Owner

nem0 commented Jan 1, 2025

Can you please attach/link a file to reproduce this?

@flarive
Copy link
Author

flarive commented Jan 1, 2025

Yes, sure, here is my fbx from 3ds max with embedded textures :
https://github.com/flarive/Cortex-Raytracer/blob/main/data/models/giantbug_embedded_textures.fbx

@flarive
Copy link
Author

flarive commented Jan 18, 2025

It's finally working, i was making a mistake.
I was ignoring VIDEOS and i finally understood that VIDEOS means EMBEDDED MEDIAS (textures, videos, sounds...)

ofbx::LoadFlags flags = ofbx::LoadFlags::IGNORE_SKIN
	| ofbx::LoadFlags::IGNORE_BONES
	| ofbx::LoadFlags::IGNORE_PIVOTS
	| ofbx::LoadFlags::IGNORE_BLEND_SHAPES
	| ofbx::LoadFlags::IGNORE_POSES
	//| ofbx::LoadFlags::IGNORE_VIDEOS
	| ofbx::LoadFlags::IGNORE_LIMBS
	| ofbx::LoadFlags::IGNORE_ANIMATIONS;

@flarive flarive closed this as completed Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants