Q : Transparent background for renderToClipboard() ?
All  1  2-8

Previous
Next
 From:  BurrMan
12083.2 In reply to 12083.1 
Elang,
I had seen discussion on this in the past. At that time the only option was generating a screen grab where you can
"isolate" the background easy enough to create your objects as needed.
This script gets rid of all viewport clutter and sets it to a "grey" color.
Then easy enough in Corel or other software to mask that color and remove it,
or invert it to extract just your object to place in a transparent background
(I think for some reason, this script is better than a "White" background..... Not sure)

code:
script:var v = moi.ui.getActiveViewport(); if ( v != null ) { moi.view.lineWidth = 3; moi.grid.display = false; moi.view.meshAngle = 5.0; moi.grid.showXYAxes = false; moi.view.showHiddenLines = false; moi.view.lightingStyle = 'CustomLevels'; moi.view.customKeyLightLevel = 100.0; moi.view.customFillLightLevel = 100.0; v.renderToClipboard(2048, 2048 ); moi.view.lineWidth = 1; moi.grid.display = true; moi.view.meshAngle = 10.0; moi.view.lightingStyle = 'Default'; moi.grid.showXYAxes = true; moi.view.showHiddenLines = true; }


This was a long time ago though. There may be a simple method now to do what you want, Lets watch for the answer

EDITED: 14 Aug by BURRMAN

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Elang
12083.3 In reply to 12083.2 
Hi, BurrMan... thank you for your quick response. I’ll definitely keep your script for future use.

The reason I’m using a white background is that, for illustration purposes, images with a white background will behave the same way when the rendering/blending mode is set to Multiply. This feature is available in CorelDRAW, and I’m fairly certain that this blending mode is very common in other software as well.

Since the clipboard image will most likely be pasted onto a white background, the result of using Multiply should be very similar to the original clipboard image.

The downside of this method, of course, is that if the pasted image (with Multiply mode applied) is moved over another element, the original image will change, even though the areas that were originally white in the background won’t change at all—anything multiplied by white will remain exactly the same colour.

That’s actually why I’m asking for help on the forum... although I’ve never heard of a way for an image in the clipboard to designate certain areas as transparent.

In any case, I really appreciate your help. Thank you very much!
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
12083.4 In reply to 12083.3 
Hi Elang,
When discussing using the modes for color in an app like Corel, you are definitely more advanced than what I can follow.

I Just wanted to show getting and object with a transparent background with this script, so I made a quick show.



Dont pull too much hair out, but if you could show me the multiply issue, you would educate me and maybe teach me to understand an area i dont really know about...

Thanks for any help you can give
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
12083.5 In reply to 12083.1 
Hi Elang, unfortunately the GPU based viewport rendering mechanism is only set up to render on to a solid color background and doesn't know how to make a transparent background.

But you can get that with PDF, AI, and SVG format output. Probably either PDF or SVG formats should go into Corel Draw well I would think.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Elang
12083.6 In reply to 12083.4 
Hi, BurrMan... thank you for the video!

I’m not a particularly skilled CorelDRAW user myself, so I asked my colleagues (who use Moi3D and need this script) to watch your video.

Their response was that, without diminishing our respect for you in any way, they are somewhat “reluctant” to involve another piece of software in the workflow besides Moi3D and CorelDRAW. So, even though the method you demonstrated in the video is perfectly valid and legitimate, they have decided to set that option aside for their individual workflows. I hope you can understand, as they work under very tight deadlines and have quite a heavy workload. For them, the most practical approach is the one that involves the shortest possible workflow.

That said, outside of working hours, I’ll ask our IT support team to install Corel PHOTO-PAINT on their computers as a backup, because I’m sure there will be situations where the method you demonstrated in the video will be exactly what we need.

For the time being, while we wait to see whether there is a way to actually achieve transparency directly, they have agreed to place the screenshot result from the clipboard as the bottom-most layer, so that anything they add afterward can simply overlap the image from the clipboard.


Sincerely,
- Elang
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Elang
12083.7 In reply to 12083.5 
Hi, Michael... Thank you for your response. We completely understand the limitation.

Unfortunately, for what we need (particularly in terms of speed and workflow efficiency) saving the viewport to a file first and then importing it into CorelDRAW is no longer practical. Our team is often working under extremely tight deadlines, and with the current workload, they frequently end up having to work overtime. Adding another step to the workflow would make things even more difficult for them.

That said, I’ve heard from our engineering designers, who generally have more flexible deadlines, that they do indeed request PDF or SVG formats, just as you mentioned, when they need a more specific or editable output. So, your response has essentially confirmed the direction of their workflow, and we sincerely appreciate your response.

Sincerely,
- Elang
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  BurrMan
12083.8 In reply to 12083.6 
Hi Elang,
Dont worry about offending. I am the one who doesn't know/understand here. Maybe I can learn something.

I mistakenly only heard "Corel" as the app and didnt differentiate that i used a different app.

Here I have a different script that uses a "Black background" to be removed by masking. I do this one in Draw



I add a second object and show myself a transparent background result using "Order of Objects"

But you had mentioned using "Multiply" which for me was a color blending mode in Bitmap software (Thats why I went into paint also)

I am not familiar with what Multiply in Draw is so definitely may be missing something.

Also using simple files as I am could be missing the mark too. Was just hoping we had a solution to offer.

Show this one to your guys. If it looks promising, I'll attach the "BlackBackgroundShot" script here

Anyway. good luck!
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
 
Show messages: All  1  2-8