Collada: add tangents and multiple UV maps to mesh export (supercedes #30112) #31523
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
7 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#31523
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
%%%This is basically #30112 but includes support for exporting tangents, as needed for tangent space normal mapping.
tangents will be exported in blender-format (a xyzw vector, w-component is used as sign to reconstruct the binormal).
vec3 normal
vec4 tangent
vec3 binormal = cross( normal , tangent.xyz ) * tangent.w
This way it works very well for me and my projects (meshes and matching normal maps created with blender), but it's maybe a better approach to export both tangent and binormal as separate streams, since COLLADA does not know about this .w trick. Also I do not like normals if shadeless (I haven't found a nice way to express this in COLLADA).
Tested with my engine, PVR tools and OSX Preview app.%%%
Changed status to: 'Open'
%%%Please ignore the first patch, it was uploaded from the wrong folder. The one with "-fixed" in the name is the correct one.
I'm sorry!%%%
%%%Hi, Daniel. Does this patch supersede http://projects.blender.org/tracker/index.php?func=detail&aid=30112 ? Then i would close the other patch.%%%
%%%Yes, please close #30112.%%%
%%%Please can you help me to verify that your patch works correct by supplying a test blend file and describe in detail what will be exported ?
i created a cube, added 3 different uv maps to it with different layouts. The difference between with your patch and without your patch
only shows up in the Material polylist, where the 3 texture coordinate maps are assigned differently to UV vertices.
However in the reimported .dae file the cube and the UV maps look identical regardless whether your patch is applied or not.
So i must have missed something.%%%
%%%Hi Gaia,
to be honest: I never cared about importing anything into blender - for us it's a content creation tool. So a full round-trip is (very likely) not possible.If it's required I'll have to spent some time here.
If you export xyz + normal + vertex color + uv map, you'll get a position,normal,color and texcoord component in COLLADA, as expected. Unfortunately, blender is currently only exporting for COLLADA 1.4.x and writes just profile_COMMON.
profile_COMMON does not offer very much, and this is a problem. You can only have one diffuse texture (with one UV layer), and even bump mapping is a hack. So if you export ie three different UV maps (like in attached test.blend / test.dae), you'll get something like this at the node:
And if you search further for "uv" inside of test.dae, you'll find only this:
<profile_COMMON>
So this is actually a limitation of using just profile_COMMON (and especially OpenCOLLADA) in blender: the correct format does only offer one UV channel.
However, if you look at the actual geometry definition, all UV maps will be written correctly:
My decision was: if you know what you're doing with blender and the resulting COLLADA, you'll get your UV maps. Normally you're writing a fragment/vertexshader that is hardcoded to a specific vertex format anyway.
If you just use a single diffuse uv-map and a secondary normal/bump uv-map it will fit perfectly into profile_COMMON. I admit that it does not make much sense to have a diffuse+normalmap combination with different UV maps.
Since this is a major limitation, I have started to work on experimental profiles, see test_GLSL.dae. So the next version of this patch will write multiple profiles: profile_COMMON, profile_GLSL, profile_GLES, ...
Please instruct me how to change/modify/document, if required. %%%
%%%I have created an alternative patch for this feature. My version is based on Daniel's, but changes always exports tangents (as opposed to just on objects with UV maps). My version also includes bitangents.
I have not tested this extensively, but it works for my purposes and should be useful as a starting point for someone to verify accuracy and perhaps add options to the UI.
My version is attached as collada-export-tangents-bitangents.diff.
Thanks.%%%
%%%Oh, the patch was made against Blender 2.65a.%%%
%%%Thanks for the patch. However would you mind to test again with the current development version from trunk ? I have added the gsoc improvements for Collada a few days ago. I have not yet checked it but possibly the new code conflicts with your patch
Added subscriber: @jesterking
Bump for request to update patch against current master. I'm trying to get an overview of the currently open tasks and patches in our tracker for COLLADA.
Closed as duplicate of #43298
Changed status from 'Duplicate' to: 'Open'
Added subscriber: @dfelinto
Changed status from 'Confirmed' to: 'Archived'
Hi, thanks for your patch.
We are undergoing a Tracker Curfew where we are automatically closing old patches.
If you think the patch is still relevant please update and re-submit it. For new features make sure there is a clear design from the user level perspective.