SceneKit: retrieving material ID from imported Collada file - swift

i have several Collada files with material IDs attached to different sets of polygons on the asset which I would like to retrieve by code using SceneKit.
Is this possible? I have tried looking for answers using google but it seems a lot is just a tutorial on using SceneKit. Perhaps my search keys aren't optimal but I only have the following which goes as close to the topic:
https://blender.stackexchange.com/questions/14584/properly-export-collada-for-use-in-scenekit
Any help greatly appreciated
Best regards

I would start with the SceneKit Editor to verify that the Collada/DAE export was successful.
Select the model, click on the Scene Graph View (at the bottom left), traverse to the node and then look it up in the Materials Inspector (one of the inspectors at the top right). If you can find it here, then programmatically it should be available as a SCNMaterial.

Related

How can I organize tiles in a tileset?

I am trying to follow the tutorial for a dungeon RPG, which involves creating a tileset.
As part of this (bookmark to exact time in video (edit: thanks, corrected)) in the video it's possible to move around tiles into separate folders. I am trying to re-create this on Unity 2022.2.0.a14.2406, and I don't seem to be able to do this: Whenever I move around tiles (from a tileset) to other folders in my assets, I end up moving the whole tileset (see image below, with the left-arrow linking to the tileset). This of course prevents me from splitting up tiles, e.g. into categories like players/walls/etc.
How would you do this? I also tried using tags, but they seem to have the same issue - they get applied to all tiles in a tileset.
Edit: Example with multiple tiles (showing the first few) extracted via 'sprite editor => slice/automatic'. It's 256 tiles, so to use them it'd important to have some way to group these tiles.
I bumped into a similar situation, and solved it rather naively by firing up Paint.NET to edit the gigantic sprite sheets I had found online into smaller similar ones for the different types of terrains, and making a distinct PNG for each character and game object.
Good naming is critical: use a short but descriptive name for each PNG, so it imports and breaks down into say Torch_0, Torch_1, etc. and Castle1_0, Castle1_1, BlueBlobBaddy_0, etc.; have all the sprites needed for a given terrain type in the same import file, import them into dedicated folders/subfolders, then splice them into tiles.
It's honestly quite a lot of work, but it's well worth it in the end.
I'm hoping this post will honor the age-old rule "if you want to learn how to do something, post the wrong way to go about it online" and will prompt a better, not-so-naive approach to this problem which I presume everyone working with 2D tilesets in Unity has encountered.

How can I create a button using mrtk 2.4 and Unity 2019.4 (AR for Hololens) with a custom shape?

Hello.
I'm trying to create a button which is shaped in a custom, trapezoid-ish shape.
so far I've tried manipulating colliders on regular MRTK - toolbox buttons, and using
a 3d model as the button (like in Hand Tracking Example 1) with the scripts that the
documentation suggests (NearInteractionTouchable & PressableButton) so far with no success.
So, is there maybe a different way to create a custom shaped button for my Hololens UI?
thanks.
After my test, the guide How to make a button from scratch works fine for me. If you got that issue while using this document, did you adjust the Press Setting after adding the PressableButton component? The default distance data may be invalid, you need to reassign the distance values according to the actual size of your 3D model. If it still cannot work after trying it, please feel free to feedback.

Black 3D Models - Unity3D

I just recently started using Unity3D, and have imported this object from Sketchfab. When I imported it, it provided all the necessary textures and meshes, but it's all black as shown in the images below. It's the same case for any other object I try to add from the asset store. I've tried to fiddle with the light source, but that doesn't seem to work. Thank you in advance.
Edit: This is what my mesh properties looks like. I have selected "pearl_body" and it's still all black.
You need to expand your model in the Hierarchy(left panel) view untill you will see Mesh Renderer component in the Inspector(right panel). Then you will be able to set the material. Probably you will need replace lambert45G in the material view with BaseTexture.
That should fix the problem.
You can read more about materials here, and about mesh renderers.
I had the same problem and found a solution. Not sure if it will work in your particular case, but here it goes:
I had a model that worked fine in unity until I rigged it, then it looked black. What caused this was that I applied a Smooth modifier after the Skin modifier. I solved it by:
Saving the Skin modifier info by clicking on "Save" at the Advanced tab.
Reset Xform / convert to editable poly / smooth modifier (needed in my case as I forgot to use it when the model was finished, before rigging)
Convert to edit poly again.
Apply skin and load the previously saved skin file.
That's all. Cheers!

Rendering a 3D object from four different angles

I am working on a project where I have to render 4 different sides of a 3D object at the same time on the screen. The output should have 4 different camera outputs rendering the front side, left side, right side and back side of the 3d object.
I found that a gaming engine like Unity may help to do something like this. However, I have just started using Unity and can't figure out how to do it.
Here is the link for some examples. This is how I want the output to look like
Well first of all, welcome to Stackoverflow. And you are right, Unity is an excellent IDE to achieve what you described.
As stated in the FAQ and here, I'm going to give you an answer I deem fitting to your question. I can post the code here in about 30 minutes which does exactly what you asked for, but then we'd miss the point of learning to program and posting at StackOverflow in general. I'll show you the way on how to start on this project, but then you'll have to try yourself. If you have any troubles after trying some more, we can help you with specific problems, provided you have researched some before and show us what you tried.
As to your question, it's relative easy to do so. First create your object in the scene, then drag and place four different Camera-objects in the screen. Using the Camera's Normalized View Port Rect (Four values that indicate where on the screen this camera view will be drawn, in Screen Coordinates (values 0-1)), you can then split up the view to show the feed of each Camera.
This ofcourse happens in a script. You can read here about Scripting in Unity. Even if you are an expert in programming, that link is worth a read when you are new to Unity.
Good luck.

Simple form with pixel manipulation in Qt

I'm completely newbie to Qt
i want to create a 800X600 window that just show some circle and be able to manipulate pixels of the form. there is no interaction between user and form(no click, no dblclick,...) it just shows some circles with one color and lines with different pixel colors(each line may have different pixel colors)
also i want to be able to change the coordination system, i mean change it from top-left to the center of the window. could anyone help me do that with some sample code?
thanks in advance for your reply.
Please try downloading the Qt Creator (IDE), then reading through the tutorials. There's a whole host of very useful information provided for free, including a lot of the code samples you are looking for.
The following examples might also be of particular interest:
Animation Framework Examples
Graphics View Examples
Painting Examples