Skip to content

Added Turntable animation exporter#210

Open
iamfunsho wants to merge 4 commits intosimlu:developfrom
funabab:export-turntable
Open

Added Turntable animation exporter#210
iamfunsho wants to merge 4 commits intosimlu:developfrom
funabab:export-turntable

Conversation

@iamfunsho
Copy link
Collaborator

Please review and test and let me know what you think, so after that i can post a tutorial on Twitter and also improve the standard image render export to also include support for background color and watermark.

@iamfunsho
Copy link
Collaborator Author

iamfunsho commented Nov 23, 2016

Arrrr merge conflict, i knew this will happen, will fix

Copy link
Owner

@simlu simlu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like what you did so far!

(1) Export seems to be slow in general. I don't think it would be hard to parallelize. Thoughts?

(2) We should be able to set the image resolution and ratio and the camera angle in the exporter and position the camera so that the whole model is visible. You can use HackedFrameBuffer to set the size. Just need to figure out how to position the camera automatically.

(3) The bounding box should be disabled for the rendering.

That's it so far! Good work, but lots more to do :)

}
// get the image rendered in container in high quality
public BufferedImage getImage() {
public BufferedImage getImage() throws Exception {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exception does this throw?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IOException while loading the font for the watermark

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make the Exception that is thrown explicit then? I.e. IOException instead of Exception?

}

// get camera position
public final float[] getCamPosition() { return this.camera.getCamPosition(); }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't write these as one line, write as

public final float[] getCamPosition() {
    return this.camera.getCamPosition();
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's a single line of code, i tends to write such methods like that (Another bad Habit) will change.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I don't like long lines very much. There is a reason swift > objective-c :)

// get camera position
public final float[] getCamPosition() { return this.camera.getCamPosition(); }

public BufferedImage getImage(final Color bgColor, final boolean addWatermark) throws Exception { return container.getImage(bgColor, addWatermark); }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do the variables need to be final? I think you can remove the final keyword.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just an agreement that i will never modify it, will change it if you don't like it

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think final should only be used when there is a reason for it. That's how I'm usually handling it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will change, but i will also love to know what your reasons are

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly "Shorter is better and faster to read".

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

turnTableImageSeq.addComponent(new SeparatorModule(""));
turnTableImageSeq.addComponent(new CheckBoxModule("add_background_color", "Add Image background color", false));
TextInputModule TISBackgroundColor = new TextInputModule("background_color", "Image Background Color: e.g #ffffff", "#000000", true);
TISBackgroundColor.setVisibleLookup("export_type=turntable_image_sequence&turntable_image_sequence.add_background_color=true");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be hidden... (bad user experience)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't hide it at first but later i thought it will be easier to understand cause if there is no background color the image background will be transparent. And also other applications does that,but if you don't like it, i can change it.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had hiding components a lot initially and it was confusing as hell :)

protected Object doInBackground() throws Exception {

// export color render (image)
progressDialog.setActivity("Processing turntable image sequence", true);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The progress bar should display the actual progress. Shouldn't be hard to do.

Copy link
Collaborator Author

@iamfunsho iamfunsho Nov 24, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actual progress of entire export instead of each images?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. There are other places in the code where I do that. You need to have a counter and also provide the max value.

// ---------------

// add "turntable animation" export
FieldSet turntableAnim = new FieldSet("turntable_animation", "Turntable Render (*.gif)");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should only be one "turnable" exporter with the option gif and separate images. The exporter options is already crowded enough!

Copy link
Collaborator Author

@iamfunsho iamfunsho Nov 24, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two does the same thing in different ways. The animation (.gif) is mostly useful if you want to quickly showcase your model on social media but the image sequence will be helpful to those who want to use the render in third party application e.g video/image editor. Merging the two together will either create a mess, give user less options or just make the list longer. BTW here on linux i experience issues of not being able to scroll in the export dialog (colladae). Another option is to remove it from export dialog and include it in the toolbar/header bar like how QBCL does it.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mhmmm, I guess we have to consider what the use cases are. I think we should keep it in the export dialog but also have quick access buttons.

I definitely like the idea of merging it. And I disagree: I think we can achieve this without creating a mess giving users less options.

Can you create a bug report for that issue with screenshot please? Thanks!


// ===========

// -- export turntable animation
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The export logic should be separated out of this file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make an export class(abstract)/interface.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I'm thinking all the exporters will be separated out eventually. But for now just doing it with this one is fine. I really need to rework the MainMenuLogic class. It's a giant mess :)

@simlu
Copy link
Owner

simlu commented Nov 24, 2016

Also I get interesting transparency issues. Somehow black is made transparent for some reason in the animated gif?

@iamfunsho
Copy link
Collaborator Author

  1. Well it depends on how many files are being exported.

  2. I like the idea of image size / resolution but i dont like the idea of setting the camera's view position before the shot, i wanted to implement it but i realize that it's going to give users less freedom and they won't be able to render from whatever angle they like, so i dropped it.

  3. I kinda like the render with the bounding box, users should disabled the bounding box before render if they don't like it. But if you insist on disabling it before render or adding an option to disable it in the exporter, it ok.

@iamfunsho
Copy link
Collaborator Author

About the transpareny issue, can you please explain more and tell me how to replicate it.

@iamfunsho
Copy link
Collaborator Author

Most issues can only be looked into when you are done with travis

@simlu
Copy link
Owner

simlu commented Nov 24, 2016

Regarding transparency issue: Here is a sample export http://i.imgur.com/locIHtR.gif

@simlu
Copy link
Owner

simlu commented Nov 24, 2016

(1) Animation even with the slowest setting it takes 30 seconds and this computer is FAST. If we allow to define the view port size that can be improved by setting it smaller default. It's pretty large currently.

(2) I'm not sure I understand? They get the same freedom? With the improvement that they don't accidentally cut of the head. It's gonna be especially nice when we show the camera angles in the main view port.

(3) I think it should be an option in the exporter then.

@simlu
Copy link
Owner

simlu commented Nov 24, 2016

I'm pretty much done with the heavy file changes for travis. You can branch off of the ci-prep branch and continue working!

@simlu
Copy link
Owner

simlu commented Nov 24, 2016

Another issue I just noticed: The file doesn't get closed after the export completes. This needs to be fixed!

@iamfunsho
Copy link
Collaborator Author

Unfortunately i can't view the video but i think i also experience a similar issue just now (all black are transparent) and i think the problem is coming from the fact that if no background color is set then black will be used as the transpareny color therefore all black pixels are rendered transparent by the gif encoder. There can be a workaround but am assuming it to be "dirty" or we just go with a semi transparent background (which won't be nice).

@simlu
Copy link
Owner

simlu commented Nov 24, 2016

Well Gif Doesnt Support Alpha Transparency. So The Workaround should Be Easy. Find Color Not In Image, set transparent Pixels To That and Use That for Transparency. Can You Set What The Gif Encoder uses?

@simlu
Copy link
Owner

simlu commented Nov 24, 2016

Ideally you should be able to tell it to use transparency...

@iamfunsho
Copy link
Collaborator Author

Gif supports transparency, that why i said it dirty, it will require me to go pixel by pixel to check which color is in the image

@iamfunsho
Copy link
Collaborator Author

Yeah i can set what color the gif encoder uses.

@iamfunsho
Copy link
Collaborator Author

How were you able to know the file is not getting close?

@simlu
Copy link
Owner

simlu commented Nov 24, 2016

Alpha transparency != transparency

@simlu
Copy link
Owner

simlu commented Nov 24, 2016

I couldn't delete it :)

@iamfunsho
Copy link
Collaborator Author

  1. About the animation speed, it can be improved but i dont currently have any ideas, gifs take some time even with ImageMagick.

  2. We seriously need to fixed the issue of head getting cut off (not showing full image), will look into that.

@iamfunsho
Copy link
Collaborator Author

iamfunsho commented Nov 24, 2016

You mean Alpha transparency like png? Unfortunately gif doesn't support that, My mistake.

@simlu
Copy link
Owner

simlu commented Nov 24, 2016

No I don't think it does? Reference?

@iamfunsho
Copy link
Collaborator Author

iamfunsho commented Nov 24, 2016

Typo, i meant to type "doesn't" :D

@iamfunsho
Copy link
Collaborator Author

The Animation exporter needs improvement, the best things to avoid are are loops that will worsen performance. So i think we should remove gif transparency background support since it's not really alpha transparency and set black as the default background color instead. What did you think.

@simlu
Copy link
Owner

simlu commented Nov 30, 2016

How are things going here? It looks really promising, but needs more work. Need help?

@iamfunsho
Copy link
Collaborator Author

No, thanks. I will improve it.

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

Successfully merging this pull request may close these issues.

3 participants